Enum rustc_middle::ty::inhabitedness::def_id_forest::DefIdForest
source · Expand description
Represents a forest of DefId
s closed under the ancestor relation. That is,
if a DefId
representing a module is contained in the forest then all
DefId
s defined in that module or submodules are also implicitly contained
in the forest.
This is used to represent a set of modules in which a type is visibly uninhabited.
We store the minimal set of DefId
s required to represent the whole set. If A and B are
DefId
s in the DefIdForest
, and A is a parent of B, then only A will be stored. When this is
used with type_uninhabited_from
, there will very rarely be more than one DefId
stored.
Variants
Empty
Single(DefId)
Multiple(&'a [DefId])
This variant is very rare. Invariant: >1 elements
Implementations
sourceimpl<'tcx> DefIdForest<'tcx>
impl<'tcx> DefIdForest<'tcx>
sourcepub fn empty() -> DefIdForest<'tcx>
pub fn empty() -> DefIdForest<'tcx>
Creates an empty forest.
sourcepub fn full() -> DefIdForest<'tcx>
pub fn full() -> DefIdForest<'tcx>
Creates a forest consisting of a single tree representing the entire crate.
sourcepub fn from_id(id: DefId) -> DefIdForest<'tcx>
pub fn from_id(id: DefId) -> DefIdForest<'tcx>
Creates a forest containing a DefId
and all its descendants.
fn as_slice(&self) -> &[DefId]
fn from_vec(
tcx: TyCtxt<'tcx>,
root_ids: SmallVec<[DefId; 1]>
) -> DefIdForest<'tcx>
sourcepub fn contains(&self, tcx: TyCtxt<'tcx>, id: DefId) -> bool
pub fn contains(&self, tcx: TyCtxt<'tcx>, id: DefId) -> bool
Tests whether the forest contains a given DefId.
sourcepub fn intersection<I>(tcx: TyCtxt<'tcx>, iter: I) -> DefIdForest<'tcx>where
I: IntoIterator<Item = DefIdForest<'tcx>>,
pub fn intersection<I>(tcx: TyCtxt<'tcx>, iter: I) -> DefIdForest<'tcx>where
I: IntoIterator<Item = DefIdForest<'tcx>>,
Calculate the intersection of a collection of forests.
sourcepub fn union<I>(tcx: TyCtxt<'tcx>, iter: I) -> DefIdForest<'tcx>where
I: IntoIterator<Item = DefIdForest<'tcx>>,
pub fn union<I>(tcx: TyCtxt<'tcx>, iter: I) -> DefIdForest<'tcx>where
I: IntoIterator<Item = DefIdForest<'tcx>>,
Calculate the union of a collection of forests.
Trait Implementations
sourceimpl<'a> Clone for DefIdForest<'a>
impl<'a> Clone for DefIdForest<'a>
sourcefn clone(&self) -> DefIdForest<'a>
fn clone(&self) -> DefIdForest<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<'a> Debug for DefIdForest<'a>
impl<'a> Debug for DefIdForest<'a>
sourceimpl<'a, '__ctx> HashStable<StableHashingContext<'__ctx>> for DefIdForest<'a>
impl<'a, '__ctx> HashStable<StableHashingContext<'__ctx>> for DefIdForest<'a>
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
impl<'a> Copy for DefIdForest<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for DefIdForest<'a>
impl<'a> Send for DefIdForest<'a>
impl<'a> Sync for DefIdForest<'a>
impl<'a> Unpin for DefIdForest<'a>
impl<'a> UnwindSafe for DefIdForest<'a>
Blanket Implementations
sourceimpl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Ctxt, T> DepNodeParams<Ctxt> for Twhere
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Ctxt, T> DepNodeParams<Ctxt> for Twhere
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
default fn fingerprint_style() -> FingerprintStyle
sourcedefault fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
default fn to_debug_str(&self, Ctxt) -> String
sourcedefault fn recover(Ctxt, &DepNode<<Ctxt as DepContext>::DepKind>) -> Option<T>
default fn recover(Ctxt, &DepNode<<Ctxt as DepContext>::DepKind>) -> Option<T>
DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it. Read moresourceimpl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
sourceimpl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
sourceimpl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
impl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
default fn from_cycle_error(tcx: CTX) -> T
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes
Size for each variant:
Empty
: 0 bytesSingle
: 8 bytesMultiple
: 20 bytes