Enum rustc_middle::ty::inhabitedness::DefIdForest[−][src]

pub enum DefIdForest {
    Empty,
    Single(DefId),
    Multiple(Arc<[DefId]>),
}

Represents a forest of DefIds closed under the ancestor relation. That is, if a DefId representing a module is contained in the forest then all DefIds 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 DefIds required to represent the whole set. If A and B are DefIds 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(Arc<[DefId]>)

This variant is very rare. Invariant: >1 elements We use Arc because this is used in the output of a query.

Implementations

impl<'tcx> DefIdForest[src]

pub fn empty() -> DefIdForest[src]

Creates an empty forest.

pub fn full(tcx: TyCtxt<'tcx>) -> DefIdForest[src]

Creates a forest consisting of a single tree representing the entire crate.

pub fn from_id(id: DefId) -> DefIdForest[src]

Creates a forest containing a DefId and all its descendants.

fn as_slice(&self) -> &[DefId]ⓘ

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

fn from_slice(root_ids: &[DefId]) -> DefIdForest[src]

pub fn is_empty(&self) -> bool[src]

Tests whether the forest is empty.

fn iter(&self) -> impl Iterator<Item = DefId> + '_[src]

Iterate over the set of roots.

pub fn contains(&self, tcx: TyCtxt<'tcx>, id: DefId) -> bool[src]

Tests whether the forest contains a given DefId.

pub fn intersection<I>(tcx: TyCtxt<'tcx>, iter: I) -> DefIdForest where
    I: IntoIterator<Item = DefIdForest>, 
[src]

Calculate the intersection of a collection of forests.

pub fn union<I>(tcx: TyCtxt<'tcx>, iter: I) -> DefIdForest where
    I: IntoIterator<Item = DefIdForest>, 
[src]

Calculate the union of a collection of forests.

Trait Implementations

impl Clone for DefIdForest[src]

impl Debug for DefIdForest[src]

impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for DefIdForest[src]

Auto Trait Implementations

impl RefUnwindSafe for DefIdForest

impl Send for DefIdForest

impl Sync for DefIdForest

impl Unpin for DefIdForest

impl UnwindSafe for DefIdForest

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]