about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAmanda Stjerna <amanda.stjerna@it.uu.se>2024-06-12 15:40:01 +0200
committerAmanda Stjerna <amanda.stjerna@it.uu.se>2024-06-12 15:48:34 +0200
commitd63708b9074ebdc69e21bee8588d28db497e9ccd (patch)
treef18127840605aa32a6e7175dd74f76b26f737050
parent2e1e119ba1189eeff2d76ed84248845f06fef1f8 (diff)
downloadrust-d63708b9074ebdc69e21bee8588d28db497e9ccd.tar.gz
rust-d63708b9074ebdc69e21bee8588d28db497e9ccd.zip
Address code review comments on the comments
-rw-r--r--compiler/rustc_borrowck/src/region_infer/mod.rs58
-rw-r--r--compiler/rustc_data_structures/src/graph/scc/mod.rs5
2 files changed, 33 insertions, 30 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs
index 971f5a2a7ec..40b58500598 100644
--- a/compiler/rustc_borrowck/src/region_infer/mod.rs
+++ b/compiler/rustc_borrowck/src/region_infer/mod.rs
@@ -492,35 +492,35 @@ impl<'tcx> RegionInferenceContext<'tcx> {
     /// This bit of logic also handles invalid universe relations
     /// for higher-kinded types.
     ///
-    // We Walk each SCC `A` and `B` such that `A: B`
-    // and ensure that universe(A) can see universe(B).
-    //
-    // This serves to enforce the 'empty/placeholder' hierarchy
-    // (described in more detail on `RegionKind`):
-    //
-    // ```
-    // static -----+
-    //   |         |
-    // empty(U0) placeholder(U1)
-    //   |      /
-    // empty(U1)
-    // ```
-    //
-    // In particular, imagine we have variables R0 in U0 and R1
-    // created in U1, and constraints like this;
-    //
-    // ```
-    // R1: !1 // R1 outlives the placeholder in U1
-    // R1: R0 // R1 outlives R0
-    // ```
-    //
-    // Here, we wish for R1 to be `'static`, because it
-    // cannot outlive `placeholder(U1)` and `empty(U0)` any other way.
-    //
-    // Thanks to this loop, what happens is that the `R1: R0`
-    // constraint has lowered the universe of `R1` to `U0`, which in turn
-    // means that the `R1: !1` constraint here will cause
-    // `R1` to become `'static`.
+    /// We Walk each SCC `A` and `B` such that `A: B`
+    /// and ensure that universe(A) can see universe(B).
+    ///
+    /// This serves to enforce the 'empty/placeholder' hierarchy
+    /// (described in more detail on `RegionKind`):
+    ///
+    /// ```ignore (illustrative)
+    /// static -----+
+    ///   |         |
+    /// empty(U0) placeholder(U1)
+    ///   |      /
+    /// empty(U1)
+    /// ```
+    ///
+    /// In particular, imagine we have variables R0 in U0 and R1
+    /// created in U1, and constraints like this;
+    ///
+    /// ```ignore (illustrative)
+    /// R1: !1 // R1 outlives the placeholder in U1
+    /// R1: R0 // R1 outlives R0
+    /// ```
+    ///
+    /// Here, we wish for R1 to be `'static`, because it
+    /// cannot outlive `placeholder(U1)` and `empty(U0)` any other way.
+    ///
+    /// Thanks to this loop, what happens is that the `R1: R0`
+    /// constraint has lowered the universe of `R1` to `U0`, which in turn
+    /// means that the `R1: !1` constraint here will cause
+    /// `R1` to become `'static`.
     fn init_free_and_bound_regions(&mut self) {
         // Update the names (if any)
         // This iterator has unstable order but we collect it all into an IndexVec
diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs
index 40d1d8d11d3..8b96b36a851 100644
--- a/compiler/rustc_data_structures/src/graph/scc/mod.rs
+++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs
@@ -80,7 +80,10 @@ struct SccDetails<A: Annotation> {
 
 // The name of this struct should discourage you from making it public and leaking
 // its representation. This message was left here by one who came before you,
-//  who learnt the hard way that making even small changes in representation is difficult when it's publicly inspectable. Obey the law of Demeter!
+// who learnt the hard way that making even small changes in representation
+// is difficult when it's publicly inspectable.
+//
+// Obey the law of Demeter!
 struct SccData<S: Idx, A: Annotation> {
     /// Maps SCC indices to their metadata, including
     /// offsets into `all_successors`.