ObligationForest in rustc_data_structures::obligation_forest - Rust (original) (raw)

Struct ObligationForest

Source

pub struct ObligationForest<O: ForestObligation> {
    nodes: Vec<Node<O>>,
    done_cache: FxHashSet<O::CacheKey>,
    active_cache: FxHashMap<O::CacheKey, usize>,
    reused_node_vec: Vec<usize>,
    obligation_tree_id_generator: impl Iterator<Item = ObligationTreeId>,
    error_cache: FxHashMap<ObligationTreeId, FxHashSet<O::CacheKey>>,
}

The list of obligations. In between calls to Self::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.

A cache of predicates that have been successfully completed.

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 Self::process_obligation for details.

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.

Source§

Source

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 variableDUMP_OBLIGATION_FOREST_GRAPHVIZ is defined.

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

Source§

Source

Source§

Source

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

Source

Registers an obligation.

Source

Source

Converts all remaining obligations to the given error.

Source

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

Source

Source

Source

Performs a fixpoint computation over the obligation list.

Source

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

Source

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

Source

Source

Source

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

Source

Source

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

Source

Source§

Source§

Source§

Source§

Source§

Must return a DOT compatible identifier naming the graph.

Source§

Maps n to a unique identifier with respect to self. The implementor is responsible for ensuring that the returned name is a valid DOT identifier.

Source§

Maps n to a label that will be used in the rendered output. The label need not be unique, and may be the empty string; the default is just the output from node_id.

Source§

Maps e to a label that will be used in the rendered output. The label need not be unique, and may be the empty string; the default is in fact the empty string.

Source§

Maps n to one of the graphviz shape names. If Noneis returned, no shape attribute is specified.

Source§

Maps n to a style that will be used in the rendered output.

Source§

Maps e to a style that will be used in the rendered output.

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: 152 bytes