@@ -66,18 +66,40 @@ impl<'tcx> OutlivesConstraintSet<'tcx> {
66
66
} )
67
67
}
68
68
69
- /// This method handles universe errors by rewriting the constraint
69
+ /// This method handles Universe errors by rewriting the constraint
70
70
/// graph. For each strongly connected component in the constraint
71
71
/// graph such that there is a series of constraints
72
72
/// A: B: C: ... : X where
73
73
/// 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.
75
77
///
76
78
/// For a more precise definition, see the documentation for
77
79
/// [`RegionTracker::has_incompatible_universes()`].
78
80
///
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
+ ///
79
101
/// Every constraint added by this method is an
80
- /// `IllegalUniverse` constraint.
102
+ /// internal `IllegalUniverse` constraint.
81
103
#[ instrument( skip( self , universal_regions, definitions) ) ]
82
104
pub ( crate ) fn add_outlives_static (
83
105
& mut self ,
0 commit comments