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

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

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]>)
Expand description

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]

fn clone(&self) -> DefIdForest[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for DefIdForest[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

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

fn hash_stable(
    &self,
    __hcx: &mut StableHashingContext<'__ctx>,
    __hasher: &mut StableHasher
)
[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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = !

pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]

pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]

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