Address code review comments on the comments

This commit is contained in:
Amanda Stjerna 2024-06-12 15:40:01 +02:00
parent 2e1e119ba1
commit d63708b907
2 changed files with 33 additions and 30 deletions

View File

@ -492,35 +492,35 @@ pub(crate) fn new(
/// This bit of logic also handles invalid universe relations /// This bit of logic also handles invalid universe relations
/// for higher-kinded types. /// for higher-kinded types.
/// ///
// We Walk each SCC `A` and `B` such that `A: B` /// We Walk each SCC `A` and `B` such that `A: B`
// and ensure that universe(A) can see universe(B). /// and ensure that universe(A) can see universe(B).
// ///
// This serves to enforce the 'empty/placeholder' hierarchy /// This serves to enforce the 'empty/placeholder' hierarchy
// (described in more detail on `RegionKind`): /// (described in more detail on `RegionKind`):
// ///
// ``` /// ```ignore (illustrative)
// static -----+ /// static -----+
// | | /// | |
// empty(U0) placeholder(U1) /// empty(U0) placeholder(U1)
// | / /// | /
// empty(U1) /// empty(U1)
// ``` /// ```
// ///
// In particular, imagine we have variables R0 in U0 and R1 /// In particular, imagine we have variables R0 in U0 and R1
// created in U1, and constraints like this; /// created in U1, and constraints like this;
// ///
// ``` /// ```ignore (illustrative)
// R1: !1 // R1 outlives the placeholder in U1 /// R1: !1 // R1 outlives the placeholder in U1
// R1: R0 // R1 outlives R0 /// R1: R0 // R1 outlives R0
// ``` /// ```
// ///
// Here, we wish for R1 to be `'static`, because it /// Here, we wish for R1 to be `'static`, because it
// cannot outlive `placeholder(U1)` and `empty(U0)` any other way. /// cannot outlive `placeholder(U1)` and `empty(U0)` any other way.
// ///
// Thanks to this loop, what happens is that the `R1: R0` /// Thanks to this loop, what happens is that the `R1: R0`
// constraint has lowered the universe of `R1` to `U0`, which in turn /// constraint has lowered the universe of `R1` to `U0`, which in turn
// means that the `R1: !1` constraint here will cause /// means that the `R1: !1` constraint here will cause
// `R1` to become `'static`. /// `R1` to become `'static`.
fn init_free_and_bound_regions(&mut self) { fn init_free_and_bound_regions(&mut self) {
// Update the names (if any) // Update the names (if any)
// This iterator has unstable order but we collect it all into an IndexVec // This iterator has unstable order but we collect it all into an IndexVec

View File

@ -80,7 +80,10 @@ struct SccDetails<A: Annotation> {
// The name of this struct should discourage you from making it public and leaking // 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, // 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> { struct SccData<S: Idx, A: Annotation> {
/// Maps SCC indices to their metadata, including /// Maps SCC indices to their metadata, including
/// offsets into `all_successors`. /// offsets into `all_successors`.