@@ -69,7 +69,7 @@ use rustc_middle::ty::{
6969 self , GenericArgKind , GenericArgsRef , PolyTypeOutlivesPredicate , Region , RegionVid , Ty , TyCtxt ,
7070 TypeFoldable as _, TypeVisitableExt ,
7171} ;
72- use rustc_span:: DUMMY_SP ;
72+ use rustc_span:: Span ;
7373use smallvec:: smallvec;
7474use tracing:: { debug, instrument} ;
7575
@@ -147,7 +147,7 @@ impl<'tcx> InferCtxt<'tcx> {
147147 sub_region : Region < ' tcx > ,
148148 cause : & ObligationCause < ' tcx > ,
149149 ) {
150- assert ! ( !self . tcx. sess. opts. unstable_opts. higher_ranked_assumptions_v2 ) ;
150+ assert ! ( !self . tcx. sess. opts. unstable_opts. assumptions_on_binders ) ;
151151
152152 // `is_global` means the type has no params, infer, placeholder, or non-`'static`
153153 // free regions. If the type has none of these things, then we can skip registering
@@ -206,12 +206,13 @@ impl<'tcx> InferCtxt<'tcx> {
206206 pub fn destructure_solver_region_constraints_for_regionck (
207207 & self ,
208208 outlives_env : & OutlivesEnvironment < ' tcx > ,
209+ span : Span ,
209210 ) {
210211 let assumptions = rustc_type_ir:: region_constraint:: Assumptions :: new (
211212 outlives_env. known_type_outlives ( ) . into_iter ( ) . cloned ( ) . collect ( ) ,
212213 outlives_env. free_region_map ( ) . relation . clone ( ) ,
213214 ) ;
214- self . destructure_solve_region_constraints ( assumptions, self ) ;
215+ self . destructure_solver_region_constraints ( assumptions, self , span ) ;
215216 }
216217
217218 pub fn destructure_solver_region_constraints_for_borrowck (
@@ -220,38 +221,38 @@ impl<'tcx> InferCtxt<'tcx> {
220221 conversion : impl TypeOutlivesDelegate < ' tcx > ,
221222 known_type_outlives : & [ PolyTypeOutlivesPredicate < ' tcx > ] ,
222223 region_outlives : TransitiveRelation < RegionVid > ,
224+ span : Span ,
223225 ) {
224226 let assumptions = rustc_type_ir:: region_constraint:: Assumptions :: new (
225227 known_type_outlives. into_iter ( ) . cloned ( ) . collect ( ) ,
226228 region_outlives. maybe_map ( |r| Some ( Region :: new_var ( self . tcx , r) ) ) . unwrap ( ) ,
227229 ) ;
228- self . destructure_solve_region_constraints ( assumptions, conversion) ;
230+ self . destructure_solver_region_constraints ( assumptions, conversion, span ) ;
229231 }
230232
231233 #[ instrument( level = "debug" , skip( self , conversion) ) ]
232- pub fn destructure_solve_region_constraints (
234+ pub fn destructure_solver_region_constraints (
233235 & self ,
234236 assumptions : rustc_type_ir:: region_constraint:: Assumptions < TyCtxt < ' tcx > > ,
235237 mut conversion : impl TypeOutlivesDelegate < ' tcx > ,
238+ span : Span ,
236239 ) {
237- if !self . tcx . sess . opts . unstable_opts . higher_ranked_assumptions_v2 {
240+ if !self . tcx . sess . opts . unstable_opts . assumptions_on_binders {
238241 return ;
239242 }
240243
241244 assert ! ( self . next_trait_solver( ) ) ;
242245
243- // FIXME(-Zhigher-ranked-assumptions-v2): Implement diagnostics
244- let origin = SubregionOrigin :: Reborrow ( DUMMY_SP ) ;
246+ let origin = SubregionOrigin :: SolverRegionConstraint ( span) ;
245247 let category = origin. to_constraint_category ( ) ;
246248
247249 let constraint = self . inner . borrow ( ) . solver_region_constraint_storage . get_constraint ( ) ;
248250 debug ! ( ?constraint) ;
249251 let constraint =
250- rustc_type_ir:: region_constraint:: destructure_type_outlives_constraints_in_universe (
252+ rustc_type_ir:: region_constraint:: destructure_type_outlives_constraints_in_root (
251253 self ,
252254 constraint,
253- None ,
254- & Some ( assumptions) ,
255+ & assumptions,
255256 ) ;
256257 debug ! ( ?constraint) ;
257258 let constraint = rustc_type_ir:: region_constraint:: evaluate_solver_constraint ( & constraint) ;
@@ -274,9 +275,9 @@ impl<'tcx> InferCtxt<'tcx> {
274275 category,
275276 ) ;
276277 }
277- // FIXME(-Zhigher-ranked-assumptions-v2 ): actually implement OR as an OR
278+ // FIXME(-Zassumptions-on-binders ): actually implement OR as an OR
278279 And ( nested) | Or ( nested) => constraints. extend ( nested) ,
279- AliasTyOutlivesFromEnv ( ..) => unreachable ! ( ) ,
280+ AliasTyOutlivesViaEnv ( ..) => unreachable ! ( ) ,
280281 PlaceholderTyOutlives ( ..) => unreachable ! ( ) ,
281282 }
282283 }
@@ -300,10 +301,11 @@ impl<'tcx> InferCtxt<'tcx> {
300301 SubregionOrigin < ' tcx > ,
301302 )
302303 -> Result < PolyTypeOutlivesPredicate < ' tcx > , NoSolution > ,
304+ span : Span ,
303305 ) -> Result < ( ) , ( PolyTypeOutlivesPredicate < ' tcx > , SubregionOrigin < ' tcx > ) > {
304306 assert ! ( !self . in_snapshot( ) , "cannot process registered region obligations in a snapshot" ) ;
305307
306- self . destructure_solver_region_constraints_for_regionck ( outlives_env) ;
308+ self . destructure_solver_region_constraints_for_regionck ( outlives_env, span ) ;
307309
308310 // Must loop since the process of normalizing may itself register region obligations.
309311 for iteration in 0 .. {
0 commit comments