Struct rustc::ty::trait_def::TraitDef
[−]
[src]
pub struct TraitDef { pub def_id: DefId, pub unsafety: Unsafety, pub paren_sugar: bool, pub specialization_graph: RefCell<Graph>, pub flags: Cell<TraitFlags>, pub def_path_hash: u64, // some fields omitted }
rustc_private
)A trait's definition with type information.
Fields
def_id: DefId
rustc_private
)unsafety: Unsafety
rustc_private
)paren_sugar: bool
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 will
be usable with the sugar (or without it).
specialization_graph: RefCell<Graph>
rustc_private
)The specialization order for impls of this trait.
flags: Cell<TraitFlags>
rustc_private
)Various flags
def_path_hash: u64
rustc_private
)The ICH of this trait's DefPath, cached here so it doesn't have to be recomputed all the time.
Methods
impl<'a, 'gcx, 'tcx> TraitDef
[src]
fn new(def_id: DefId,
unsafety: Unsafety,
paren_sugar: bool,
def_path_hash: u64)
-> TraitDef
unsafety: Unsafety,
paren_sugar: bool,
def_path_hash: u64)
-> TraitDef
rustc_private
)fn object_safety(&self) -> Option<bool>
rustc_private
)fn set_object_safety(&self, is_safe: bool)
rustc_private
)fn record_local_impl(&self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl_def_id: DefId,
impl_trait_ref: TraitRef<'tcx>)
tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl_def_id: DefId,
impl_trait_ref: TraitRef<'tcx>)
rustc_private
)Records a trait-to-implementation mapping for a crate-local impl.
fn record_has_default_impl(&self)
rustc_private
)Records a trait-to-implementation mapping.
fn record_remote_impl(&self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl_def_id: DefId,
impl_trait_ref: TraitRef<'tcx>,
parent_impl: DefId)
tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl_def_id: DefId,
impl_trait_ref: TraitRef<'tcx>,
parent_impl: DefId)
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>
tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl_def_id: DefId)
-> Result<(), OverlapError>
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>
rustc_private
)fn is_complete(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool
rustc_private
)Whether the impl set and specialization graphs are complete.
fn for_each_impl<F: FnMut(DefId)>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, f: F)
rustc_private
)fn for_each_relevant_impl<F: FnMut(DefId)>(&self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
self_ty: Ty<'tcx>,
f: F)
tcx: TyCtxt<'a, 'gcx, 'tcx>,
self_ty: Ty<'tcx>,
f: F)
rustc_private
)Iterate over every impl that could possibly match the
self-type self_ty
.