Struct rustc::ty::trait_def::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 specialization_graph: RefCell<Graph>,
    pub flags: Cell<TraitFlags>,
    // some fields omitted
}
Unstable (rustc_private)

As TypeScheme but for a trait ref.

Fields

unsafety: Unsafety
Unstable (rustc_private)
paren_sugar: bool
Unstable (rustc_private)

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: Generics<'tcx>
Unstable (rustc_private)

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: TraitRef<'tcx>
Unstable (rustc_private)
associated_type_names: Vec<Name>
Unstable (rustc_private)

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

specialization_graph: RefCell<Graph>
Unstable (rustc_private)

The specialization order for impls of this trait.

flags: Cell<TraitFlags>
Unstable (rustc_private)

Various flags

Methods

impl<'a, 'gcx, 'tcx> TraitDef<'tcx>
[src]

fn new(unsafety: Unsafety, paren_sugar: bool, generics: Generics<'tcx>, trait_ref: TraitRef<'tcx>, associated_type_names: Vec<Name>) -> TraitDef<'tcx>

fn def_id(&self) -> DefId

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

fn set_object_safety(&self, is_safe: bool)

fn record_local_impl(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, impl_def_id: DefId, impl_trait_ref: TraitRef<'tcx>)

Unstable (rustc_private)

Records a trait-to-implementation mapping for a crate-local impl.

fn record_remote_impl(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, impl_def_id: DefId, impl_trait_ref: TraitRef<'tcx>, parent_impl: DefId)

Unstable (rustc_private)

Records a trait-to-implementation mapping for a non-local impl.

The parent_impl is the immediately-less-specialized impl, or the trait's def ID if the impl is not a specialization -- information that should be pulled from the metadata.

fn add_impl_for_specialization(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, impl_def_id: DefId) -> Result<()OverlapError>

Unstable (rustc_private)

Adds a local impl into the specialization graph, returning an error with overlap information if the impl overlaps but does not specialize an existing impl.

fn ancestors(&'a self, of_impl: DefId) -> Ancestors<'a, 'tcx>

fn for_each_impl<F: FnMut(DefId)>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, f: F)

fn for_each_relevant_impl<F: FnMut(DefId)>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>, f: F)

Unstable (rustc_private)

Iterate over every impl that could possibly match the self-type self_ty.

Trait Implementations

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

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

Formats the value using the given formatter.