Struct rustc_trans::middle::ty::TraitRefExperimental [-]  [+] [src]

pub struct TraitRef {
    pub def_id: DefId,
    pub substs: Substs,
}

A complete reference to a trait. These take numerous guises in syntax, but perhaps the most recognizable form is in a where clause:

T : Foo<U>

This would be represented by a trait-reference where the def-id is the def-id for the trait Foo and the substs defines T as parameter 0 in the SelfSpace and U as parameter 0 in the TypeSpace.

Trait references also appear in object types like Foo<U>, but in that case the Self parameter is absent from the substitutions.

Note that a TraitRef introduces a level of region binding, to account for higher-ranked trait bounds like T : for<'a> Foo<&'a U> or higher-ranked object types.

Fields

def_id
substs

Methods

impl TraitRef

fn new(def_id: DefId, substs: Substs) -> TraitRef

fn self_ty(&self) -> t

fn input_types(&self) -> &[t]

fn has_escaping_regions(&self) -> bool

fn has_bound_regions(&self) -> bool

Trait Implementations

impl TypeFoldable for TraitRef

fn fold_with<'tcx, F: TypeFolder<'tcx>>(&self, folder: &mut F) -> TraitRef

impl HigherRankedFoldable for TraitRef

fn fold_contents<'tcx, F: TypeFolder<'tcx>>(&self, folder: &mut F) -> TraitRef

impl HigherRankedCombineable for TraitRef

fn super_combine<'tcx, C: Combine<'tcx>>(combiner: &C, a: &TraitRef, b: &TraitRef) -> Result<TraitRef, type_err>

impl Repr for TraitRef

fn repr(&self, tcx: &ctxt) -> String

impl UserString for TraitRef

fn user_string(&self, tcx: &ctxt) -> String

Derived Implementations

impl Show for TraitRef

fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), FormatError>

impl<__S: Writer> Hash<__S> for TraitRef

fn hash(&self, __arg_0: &mut __S)

impl Eq for TraitRef

fn assert_receiver_is_total_eq(&self)

impl PartialEq for TraitRef

fn eq(&self, __arg_0: &TraitRef) -> bool

fn ne(&self, __arg_0: &TraitRef) -> bool

fn ne(&self, &TraitRef) -> bool

impl Clone for TraitRef

fn clone(&self) -> TraitRef

fn clone_from(&mut self, &TraitRef)