Struct rustc::ty::TraitRef [] [src]

pub struct TraitRef<'tcx> {
    pub def_id: DefId,
    pub substs: &'tcx Substs<'tcx>,
}
Unstable (rustc_private)

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: DefId
Unstable (rustc_private)
substs: &'tcx Substs<'tcx>
Unstable (rustc_private)

Methods

impl<'tcx> TraitRef<'tcx>
[src]

fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> TraitRef<'tcx>

fn self_ty(&self) -> Ty<'tcx>

fn input_types(&self) -> &[Ty<'tcx>]

Trait Implementations

impl<'tcx> Resolvable<'tcx> for TraitRef<'tcx>
[src]

fn resolve<'a, 'gcx>(&self, infcx: &InferCtxt<'a, 'gcx, 'tcx>) -> TraitRef<'tcx>

impl<'tcx> Relate<'tcx> for TraitRef<'tcx>
[src]

fn relate<'a, 'gcx, R>(relation: &mut R, a: &TraitRef<'tcx>, b: &TraitRef<'tcx>) -> RelateResult<'tcx, TraitRef<'tcx>> where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a + 'tcx, 'tcx: 'a

impl<'a, 'tcx> Lift<'tcx> for TraitRef<'a>
[src]

type Lifted = TraitRef<'tcx>

fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<TraitRef<'tcx>>

impl<'tcx> TypeFoldable<'tcx> for TraitRef<'tcx>
[src]

fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self

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

fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool

fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool

fn has_regions_escaping_depth(&self, depth: u32) -> bool

fn has_escaping_regions(&self) -> bool

fn has_type_flags(&self, flags: TypeFlags) -> bool

fn has_projection_types(&self) -> bool

fn references_error(&self) -> bool

fn has_param_types(&self) -> bool

fn has_self_ty(&self) -> bool

fn has_infer_types(&self) -> bool

fn needs_infer(&self) -> bool

fn needs_subst(&self) -> bool

fn has_closure_types(&self) -> bool

fn has_erasable_regions(&self) -> bool

fn is_global(&self) -> bool

Indicates whether this value references only 'global' types/lifetimes that are the same regardless of what fn we are in. This is used for caching. Errs on the side of returning false. Read more

impl<'tcx> ToPolyTraitRef<'tcx> for TraitRef<'tcx>
[src]

fn to_poly_trait_ref(&self) -> PolyTraitRef<'tcx>

impl<'tcx> ToPredicate<'tcx> for TraitRef<'tcx>
[src]

fn to_predicate(&self) -> Predicate<'tcx>

impl<'tcx> Debug for TraitRef<'tcx>
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'tcx> Display for TraitRef<'tcx>
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

Derived Implementations

impl<'tcx> Hash for TraitRef<'tcx>
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl<'tcx> Eq for TraitRef<'tcx>
[src]

impl<'tcx> PartialEq for TraitRef<'tcx>
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl<'tcx> Clone for TraitRef<'tcx>
[src]

fn clone(&self) -> TraitRef<'tcx>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<'tcx> Copy for TraitRef<'tcx>
[src]