[][src]Struct rustc_data_structures::obligation_forest::ObligationForest

pub struct ObligationForest<O: ForestObligation> {
    nodes: Vec<Node<O>>,
    done_cache: FxHashSet<O::Predicate>,
    active_cache: FxHashMap<O::Predicate, usize>,
    node_rewrites: RefCell<Vec<usize>>,
    obligation_tree_id_generator: Map<RangeFrom<usize>, fn(_: usize) -> ObligationTreeId>,
    error_cache: FxHashMap<ObligationTreeId, FxHashSet<O::Predicate>>,
}
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Fields

nodes: Vec<Node<O>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The list of obligations. In between calls to process_obligations, this list only contains nodes in the Pending or Waiting state.

usize indices are used here and throughout this module, rather than rustc_index::newtype_index! indices, because this code is hot enough that the u32-to-usize conversions that would be required are significant, and space considerations are not important.

done_cache: FxHashSet<O::Predicate>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A cache of predicates that have been successfully completed.

active_cache: FxHashMap<O::Predicate, usize>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A cache of the nodes in nodes, indexed by predicate. Unfortunately, its contents are not guaranteed to match those of nodes. See the comments in process_obligation for details.

node_rewrites: RefCell<Vec<usize>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

A vector reused in compress(), to avoid allocating new vectors.

obligation_tree_id_generator: Map<RangeFrom<usize>, fn(_: usize) -> ObligationTreeId>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

error_cache: FxHashMap<ObligationTreeId, FxHashSet<O::Predicate>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Per tree error cache. This is used to deduplicate errors, which is necessary to avoid trait resolution overflow in some cases.

See this for details.

Methods

impl<O: ForestObligation> ObligationForest<O>[src]

pub fn dump_graphviz<P: AsRef<Path>>(&self, dir: P, description: &str)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Creates a graphviz representation of the obligation forest. Given a directory this will create files with name of the format <counter>_<description>.gv. The counter is global and is maintained internally.

Calling this will do nothing unless the environment variable DUMP_OBLIGATION_FOREST_GRAPHVIZ is defined.

A few post-processing that you might want to do make the forest easier to visualize:

  • sed 's,std::[a-z]*::,,g' — Deletes the std::<package>:: prefix of paths.
  • sed 's,"Binder(TraitPredicate(<\(.*\)>)) (\([^)]*\))","\1 (\2)",' — Transforms Binder(TraitPredicate(<predicate>)) into just <predicate>.

impl<O: ForestObligation> ObligationForest<O>[src]

pub fn new() -> ObligationForest<O>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn len(&self) -> usize[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns the total number of nodes in the forest that have not yet been fully resolved.

pub fn register_obligation(&mut self, obligation: O)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Registers an obligation.

fn register_obligation_at(
    &mut self,
    obligation: O,
    parent: Option<usize>
) -> Result<(), ()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn to_errors<E: Clone>(&mut self, error: E) -> Vec<Error<O, E>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts all remaining obligations to the given error.

pub fn map_pending_obligations<P, F>(&self, f: F) -> Vec<P> where
    F: Fn(&O) -> P, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns the set of obligations that are in a pending state.

fn insert_into_error_cache(&mut self, index: usize)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub fn process_obligations<P>(
    &mut self,
    processor: &mut P,
    do_completed: DoCompleted
) -> Outcome<O, P::Error> where
    P: ObligationProcessor<Obligation = O>, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Performs a pass through the obligation list. This must be called in a loop until outcome.stalled is false.

This cannot be unrolled (presently, at least).

fn error_at(&self, index: usize) -> Vec<O>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns a vector of obligations for p and all of its ancestors, putting them into the error state in the process.

fn mark_successes(&self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Mark all Waiting nodes as Success, except those that depend on a pending node.

fn inlined_mark_dependents_as_waiting(&self, node: &Node<O>)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn uninlined_mark_dependents_as_waiting(&self, node: &Node<O>)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn process_cycles<P>(&self, processor: &mut P) where
    P: ObligationProcessor<Obligation = O>, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Report cycles between all Success nodes, and convert all Success nodes to Done. This must be called after mark_successes.

fn find_cycles_from_node<P>(
    &self,
    stack: &mut Vec<usize>,
    processor: &mut P,
    index: usize
) where
    P: ObligationProcessor<Obligation = O>, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn compress(&mut self, do_completed: DoCompleted) -> Option<Vec<O>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Compresses the vector, removing all popped nodes. This adjusts the indices and hence invalidates any outstanding indices. process_cycles must be run beforehand to remove any cycles on Success nodes.

fn apply_rewrites(&mut self, node_rewrites: &[usize])[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Trait Implementations

impl<'a, O: ForestObligation + 'a> GraphWalk<'a> for &'a ObligationForest<O>[src]

type Node = usize

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

type Edge = (usize, usize)

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<'a, O: ForestObligation + 'a> Labeller<'a> for &'a ObligationForest<O>[src]

type Node = usize

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

type Edge = (usize, usize)

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Auto Trait Implementations

impl<O> !RefUnwindSafe for ObligationForest<O>

impl<O> Send for ObligationForest<O> where
    O: Send,
    <O as ForestObligation>::Predicate: Send

impl<O> !Sync for ObligationForest<O>

impl<O> Unpin for ObligationForest<O> where
    O: Unpin,
    <O as ForestObligation>::Predicate: Unpin

impl<O> UnwindSafe for ObligationForest<O> where
    O: UnwindSafe,
    <O as ForestObligation>::Predicate: UnwindSafe

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> Erased for T[src]

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

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

impl<E> SpecializationError for E[src]

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.