Struct rustc_lint::middle::ty::TraitDef [−] [src]

pub struct TraitDef<'tcx> {
    pub unsafety: Unsafety,
    pub paren_sugar: bool,
    pub generics: Generics<'tcx>,
    pub trait_ref: TraitRef<'tcx>,
    pub associated_type_names: Vec<Name>,
    pub nonblanket_impls: RefCell<HashMap<SimplifiedType, Vec<DefId>, DefaultState<FnvHasher>>>,
    pub blanket_impls: RefCell<Vec<DefId>>,
    pub flags: Cell<TraitFlags>,
}
Unstable

As TypeScheme but for a trait ref.

Fields

unsafety
Unstable
paren_sugar
Unstable

If true, then this trait had the #[rustc_paren_sugar] attribute, indicating that it should be used with Foo() sugar. This is a temporary thing -- eventually any trait wil be usable with the sugar (or without it).

generics
Unstable

Generic type definitions. Note that Self is listed in here as having a single bound, the trait itself (e.g., in the trait Eq, there is a single bound Self : Eq). This is so that default methods get to assume that the Self parameters implements the trait.

trait_ref
Unstable
associated_type_names
Unstable

A list of the associated types defined in this trait. Useful for resolving X::Foo type markers.

nonblanket_impls
Unstable

Impls of the trait.

blanket_impls
Unstable

Blanket impls associated with the trait.

flags
Unstable

Various flags

Methods

impl<'tcx> TraitDef<'tcx>

fn object_safety(&self) -> Option<bool>

Unstable

fn set_object_safety(&self, is_safe: bool)

Unstable

fn record_impl(&self, tcx: &ctxt<'tcx>, impl_def_id: DefId, impl_trait_ref: TraitRef<'tcx>)

Unstable

Records a trait-to-implementation mapping.

fn for_each_impl<F>(&self, tcx: &ctxt<'tcx>, f: F) where F: FnMut(DefId) -> ()

Unstable

fn for_each_relevant_impl<F>(&self, tcx: &ctxt<'tcx>, self_ty: &'tcx TyS<'tcx>, f: F) where F: FnMut(DefId) -> ()

Unstable

Trait Implementations

impl<'tcx> Repr<'tcx> for TraitDef<'tcx>

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