obligation forest docs
This commit is contained in:
parent
ec0a0ca3f4
commit
6a1f5eab83
3 changed files with 10 additions and 7 deletions
|
@ -132,11 +132,11 @@ type ObligationTreeIdGenerator =
|
||||||
std::iter::Map<std::ops::RangeFrom<usize>, fn(usize) -> ObligationTreeId>;
|
std::iter::Map<std::ops::RangeFrom<usize>, fn(usize) -> ObligationTreeId>;
|
||||||
|
|
||||||
pub struct ObligationForest<O: ForestObligation> {
|
pub struct ObligationForest<O: ForestObligation> {
|
||||||
/// The list of obligations. In between calls to `process_obligations`,
|
/// The list of obligations. In between calls to [Self::process_obligations],
|
||||||
/// this list only contains nodes in the `Pending` or `Waiting` state.
|
/// this list only contains nodes in the `Pending` or `Waiting` state.
|
||||||
///
|
///
|
||||||
/// `usize` indices are used here and throughout this module, rather than
|
/// `usize` indices are used here and throughout this module, rather than
|
||||||
/// `rustc_index::newtype_index!` indices, because this code is hot enough
|
/// [`rustc_index::newtype_index!`] indices, because this code is hot enough
|
||||||
/// that the `u32`-to-`usize` conversions that would be required are
|
/// that the `u32`-to-`usize` conversions that would be required are
|
||||||
/// significant, and space considerations are not important.
|
/// significant, and space considerations are not important.
|
||||||
nodes: Vec<Node<O>>,
|
nodes: Vec<Node<O>>,
|
||||||
|
@ -146,10 +146,11 @@ pub struct ObligationForest<O: ForestObligation> {
|
||||||
|
|
||||||
/// A cache of the nodes in `nodes`, indexed by predicate. Unfortunately,
|
/// A cache of the nodes in `nodes`, indexed by predicate. Unfortunately,
|
||||||
/// its contents are not guaranteed to match those of `nodes`. See the
|
/// its contents are not guaranteed to match those of `nodes`. See the
|
||||||
/// comments in `process_obligation` for details.
|
/// comments in [`Self::process_obligation` for details.
|
||||||
active_cache: FxHashMap<O::CacheKey, usize>,
|
active_cache: FxHashMap<O::CacheKey, usize>,
|
||||||
|
|
||||||
/// A vector reused in compress() and find_cycles_from_node(), to avoid allocating new vectors.
|
/// A vector reused in [Self::compress()] and [Self::find_cycles_from_node()],
|
||||||
|
/// to avoid allocating new vectors.
|
||||||
reused_node_vec: Vec<usize>,
|
reused_node_vec: Vec<usize>,
|
||||||
|
|
||||||
obligation_tree_id_generator: ObligationTreeIdGenerator,
|
obligation_tree_id_generator: ObligationTreeIdGenerator,
|
||||||
|
|
|
@ -123,7 +123,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See `infer::region_constraints::RegionConstraintCollector::leak_check`.
|
/// See [RegionConstraintCollector::leak_check][1].
|
||||||
|
///
|
||||||
|
/// [1]: crate::infer::region_constraints::RegionConstraintCollector::leak_check
|
||||||
pub fn leak_check(
|
pub fn leak_check(
|
||||||
&self,
|
&self,
|
||||||
overly_polymorphic: bool,
|
overly_polymorphic: bool,
|
||||||
|
|
|
@ -314,7 +314,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
||||||
return ProcessResult::Unchanged;
|
return ProcessResult::Unchanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.progress_changed_obligations(pending_obligation)
|
self.process_changed_obligations(pending_obligation)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_backedge<'c, I>(
|
fn process_backedge<'c, I>(
|
||||||
|
@ -338,7 +338,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
|
||||||
// actually uses this, so move this part of the code
|
// actually uses this, so move this part of the code
|
||||||
// out of that loop.
|
// out of that loop.
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
fn progress_changed_obligations(
|
fn process_changed_obligations(
|
||||||
&mut self,
|
&mut self,
|
||||||
pending_obligation: &mut PendingPredicateObligation<'tcx>,
|
pending_obligation: &mut PendingPredicateObligation<'tcx>,
|
||||||
) -> ProcessResult<PendingPredicateObligation<'tcx>, FulfillmentErrorCode<'tcx>> {
|
) -> ProcessResult<PendingPredicateObligation<'tcx>, FulfillmentErrorCode<'tcx>> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue