@@ -66,18 +66,40 @@ impl<'tcx> OutlivesConstraintSet<'tcx> {
6666 } )
6767 }
6868
69- /// This method handles universe errors by rewriting the constraint
69+ /// This method handles Universe errors by rewriting the constraint
7070 /// graph. For each strongly connected component in the constraint
7171 /// graph such that there is a series of constraints
7272 /// A: B: C: ... : X where
7373 /// A's universe is smaller than X's and A is a placeholder,
74- /// add A: 'static.
74+ /// add a constraint that A: 'static. This is a safe upper bound
75+ /// in the face of borrow checker/trait solver limitations that will
76+ /// eventually go away.
7577 ///
7678 /// For a more precise definition, see the documentation for
7779 /// [`RegionTracker::has_incompatible_universes()`].
7880 ///
81+ /// This edge case used to be handled during constraint propagation
82+ /// by iterating over the strongly connected components in the constraint
83+ /// graph while maintaining a set of bookkeeping mappings similar
84+ /// to what is stored in `RegionTracker` and manually adding 'sttaic as
85+ /// needed.
86+ ///
87+ /// It was rewritten as part of the Polonius project with the goal of moving
88+ /// higher-kindedness concerns out of the path of the borrow checker,
89+ /// for two reasons:
90+ ///
91+ /// 1. Implementing Polonius is difficult enough without also
92+ /// handling them.
93+ /// 2. The long-term goal is to handle higher-kinded concerns
94+ /// in the trait solver, where they belong. This avoids
95+ /// logic duplication and allows future trait solvers
96+ /// to compute better bounds than for example our
97+ /// "must outlive 'static" here.
98+ ///
99+ /// This code is a stop-gap measure in preparation for the future trait solver.
100+ ///
79101 /// Every constraint added by this method is an
80- /// `IllegalUniverse` constraint.
102+ /// internal `IllegalUniverse` constraint.
81103 #[ instrument( skip( self , universal_regions, definitions) ) ]
82104 pub ( crate ) fn add_outlives_static (
83105 & mut self ,
0 commit comments