diff options
| author | lcnr <rust@lcnr.de> | 2025-06-17 10:27:31 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-06-18 17:14:01 +0200 |
| commit | 8710c1fec9bb8d9a3f235c8143f8e94b98bed69c (patch) | |
| tree | 7b34181833402b75f4234fd7852c6161814aaf28 | |
| parent | 2e57845de7b81dd984a8010e191b7b8fbb62a1f9 (diff) | |
| download | rust-8710c1fec9bb8d9a3f235c8143f8e94b98bed69c.tar.gz rust-8710c1fec9bb8d9a3f235c8143f8e94b98bed69c.zip | |
update comment
| -rw-r--r-- | compiler/rustc_type_ir/src/search_graph/mod.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_type_ir/src/search_graph/mod.rs b/compiler/rustc_type_ir/src/search_graph/mod.rs index 2bd0fa6866e..953dc2d1bc8 100644 --- a/compiler/rustc_type_ir/src/search_graph/mod.rs +++ b/compiler/rustc_type_ir/src/search_graph/mod.rs @@ -381,18 +381,16 @@ impl PathsToNested { /// The nested goals of each stack entry and the path from the /// stack entry to that nested goal. /// +/// They are used when checking whether reevaluating a global cache +/// would encounter a cycle or use a provisional cache entry given the +/// currentl search graph state. We need to disable the global cache +/// in this case as it could otherwise result in behaviorial differences. +/// Cycles can impact behavior. The cycle ABA may have different final +/// results from a the cycle BAB depending on the cycle root. +/// /// We only start tracking nested goals once we've either encountered /// overflow or a solver cycle. This is a performance optimization to /// avoid tracking nested goals on the happy path. -/// -/// We use nested goals for two reasons: -/// - when rebasing provisional cache entries -/// - when checking whether we have to ignore a global cache entry as reevaluating -/// it would encounter a cycle or use a provisional cache entry. -/// -/// We need to disable the global cache if using it would hide a cycle, as -/// cycles can impact behavior. The cycle ABA may have different final -/// results from a the cycle BAB depending on the cycle root. #[derive_where(Debug, Default, Clone; X: Cx)] struct NestedGoals<X: Cx> { nested_goals: HashMap<X::Input, PathsToNested>, |
