Struct rustc::traits::specialization_graph::Graph
[−]
[src]
pub struct Graph { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
A per-trait graph of impls in specialization order. At the moment, this graph forms a tree rooted with the trait itself, with all other nodes representing impls, and parent-child relationships representing specializations.
The graph provides two key services:
Construction, which implicitly checks for overlapping impls (i.e., impls that overlap but where neither specializes the other -- an artifact of the simple "chain" rule.
Parent extraction. In particular, the graph can give you the immediate parents of a given specializing impl, which is needed for extracting default items amongst other things. In the simple "chain" rule, every impl has at most one parent.
Methods
impl<'a, 'gcx, 'tcx> Graph
[src]
pub fn new() -> Graph
[src]
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn insert(
&mut self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl_def_id: DefId
) -> Result<Option<OverlapError>, OverlapError>
[src]
&mut self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl_def_id: DefId
) -> Result<Option<OverlapError>, OverlapError>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Insert a local impl into the specialization graph. If an existing impl
conflicts with it (has overlap, but neither specializes the other),
information about the area of overlap is returned in the Err
.
pub fn record_impl_from_cstore(
&mut self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
parent: DefId,
child: DefId
)
[src]
&mut self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
parent: DefId,
child: DefId
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Insert cached metadata mapping from a child impl back to its parent.
pub fn parent(&self, child: DefId) -> DefId
[src]
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
The parent of a given impl, which is the def id of the trait when the impl is a "specialization root".
Trait Implementations
impl<'tcx> HashStable<StableHashingContext<'tcx>> for Graph
[src]
fn hash_stable<W: StableHasherResult>(
&self,
__ctx: &mut StableHashingContext<'tcx>,
__hasher: &mut StableHasher<W>
)
[src]
&self,
__ctx: &mut StableHashingContext<'tcx>,
__hasher: &mut StableHasher<W>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?