]> git.lizzy.rs Git - rust.git/commitdiff
add note about indirect cycles
authorlcnr <rust@lcnr.de>
Tue, 17 Jan 2023 15:00:00 +0000 (16:00 +0100)
committerlcnr <rust@lcnr.de>
Wed, 18 Jan 2023 07:11:15 +0000 (08:11 +0100)
compiler/rustc_trait_selection/src/solve/search_graph/cache.rs

index cb00fe6bf14af167bce9abbf2f90ca5b4de12af1..730a8e6125887ae6fcdfb1e7379f38df33d2016e 100644 (file)
@@ -59,6 +59,10 @@ pub(super) fn is_empty(&self) -> bool {
     /// Adds a dependency from the current leaf to `target` in the cache
     /// to prevent us from moving any goals which depend on the current leaf
     /// to the global cache while we're still computing `target`.
+    ///
+    /// Its important to note that `target` may already be part of a different cycle.
+    /// In this case we have to ensure that we also depend on all other goals
+    /// in the existing cycle in addition to the potentially direct cycle with `target`.
     pub(super) fn add_dependency_of_leaf_on(&mut self, target: EntryIndex) {
         let depth = self.entries[target].depth;
         for provisional_entry in &mut self.entries.raw[target.index()..] {