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

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

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<'tcx> TraitRef<'tcx>

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

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

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

Trait Implementations

impl<'tcx> RegionEscape for TraitRef<'tcx>

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

fn has_escaping_regions(&self) -> bool

impl<'tcx> HasProjectionTypes for TraitRef<'tcx>

fn has_projection_types(&self) -> bool

impl<'tcx> ReferencesError for TraitRef<'tcx>

fn references_error(&self) -> bool

impl<'tcx> TypeFoldable<'tcx> for TraitRef<'tcx>

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

impl<'a, 'tcx> Relate<'a, 'tcx> for TraitRef<'tcx> where 'tcx: 'a

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

impl<'tcx> Repr<'tcx> for TraitRef<'tcx>

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

impl<'tcx> UserString<'tcx> for TraitRef<'tcx>

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

Derived Implementations

impl<'tcx> Debug for TraitRef<'tcx>

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

impl<'tcx> Hash for TraitRef<'tcx>

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

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

impl<'tcx> Eq for TraitRef<'tcx>

impl<'tcx> PartialEq<TraitRef<'tcx>> for TraitRef<'tcx>

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

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

impl<'tcx> Clone for TraitRef<'tcx>

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

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