@@ -6,8 +6,8 @@ use rustc_middle::span_bug;
66use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
77use rustc_span:: Span ;
88
9- impl < ' tcx > crate :: MirBorrowckCtxt < ' _ , ' _ , ' _ , ' tcx > {
10- pub fn dcx ( & self ) -> DiagCtxtHandle < ' tcx > {
9+ impl < ' infcx , ' tcx > crate :: MirBorrowckCtxt < ' _ , ' _ , ' infcx , ' tcx > {
10+ pub fn dcx ( & self ) -> DiagCtxtHandle < ' infcx > {
1111 self . infcx . dcx ( )
1212 }
1313
@@ -18,7 +18,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
1818 place : & str ,
1919 borrow_place : & str ,
2020 value_place : & str ,
21- ) -> Diag < ' tcx > {
21+ ) -> Diag < ' infcx > {
2222 self . dcx ( ) . create_err ( crate :: session_diagnostics:: MoveBorrow {
2323 place,
2424 span,
@@ -34,7 +34,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
3434 desc : & str ,
3535 borrow_span : Span ,
3636 borrow_desc : & str ,
37- ) -> Diag < ' tcx > {
37+ ) -> Diag < ' infcx > {
3838 struct_span_code_err ! (
3939 self . dcx( ) ,
4040 span,
@@ -54,7 +54,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
5454 old_loan_span : Span ,
5555 old_opt_via : & str ,
5656 old_load_end_span : Option < Span > ,
57- ) -> Diag < ' tcx > {
57+ ) -> Diag < ' infcx > {
5858 let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
5959 let mut err = struct_span_code_err ! (
6060 self . dcx( ) ,
@@ -101,7 +101,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
101101 desc : & str ,
102102 old_loan_span : Span ,
103103 old_load_end_span : Option < Span > ,
104- ) -> Diag < ' tcx > {
104+ ) -> Diag < ' infcx > {
105105 let mut err = struct_span_code_err ! (
106106 self . dcx( ) ,
107107 new_loan_span,
@@ -134,7 +134,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
134134 noun_old : & str ,
135135 old_opt_via : & str ,
136136 previous_end_span : Option < Span > ,
137- ) -> Diag < ' tcx > {
137+ ) -> Diag < ' infcx > {
138138 let mut err = struct_span_code_err ! (
139139 self . dcx( ) ,
140140 new_loan_span,
@@ -166,7 +166,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
166166 old_opt_via : & str ,
167167 previous_end_span : Option < Span > ,
168168 second_borrow_desc : & str ,
169- ) -> Diag < ' tcx > {
169+ ) -> Diag < ' infcx > {
170170 let mut err = struct_span_code_err ! (
171171 self . dcx( ) ,
172172 new_loan_span,
@@ -198,7 +198,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
198198 kind_old : & str ,
199199 msg_old : & str ,
200200 old_load_end_span : Option < Span > ,
201- ) -> Diag < ' tcx > {
201+ ) -> Diag < ' infcx > {
202202 let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
203203 let mut err = struct_span_code_err ! (
204204 self . dcx( ) ,
@@ -239,7 +239,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
239239 span : Span ,
240240 borrow_span : Span ,
241241 desc : & str ,
242- ) -> Diag < ' tcx > {
242+ ) -> Diag < ' infcx > {
243243 struct_span_code_err ! (
244244 self . dcx( ) ,
245245 span,
@@ -256,20 +256,20 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
256256 span : Span ,
257257 desc : & str ,
258258 is_arg : bool ,
259- ) -> Diag < ' tcx > {
259+ ) -> Diag < ' infcx > {
260260 let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" } ;
261261 struct_span_code_err ! ( self . dcx( ) , span, E0384 , "cannot assign {} {}" , msg, desc)
262262 }
263263
264- pub ( crate ) fn cannot_assign ( & self , span : Span , desc : & str ) -> Diag < ' tcx > {
264+ pub ( crate ) fn cannot_assign ( & self , span : Span , desc : & str ) -> Diag < ' infcx > {
265265 struct_span_code_err ! ( self . dcx( ) , span, E0594 , "cannot assign to {}" , desc)
266266 }
267267
268268 pub ( crate ) fn cannot_move_out_of (
269269 & self ,
270270 move_from_span : Span ,
271271 move_from_desc : & str ,
272- ) -> Diag < ' tcx > {
272+ ) -> Diag < ' infcx > {
273273 struct_span_code_err ! (
274274 self . dcx( ) ,
275275 move_from_span,
@@ -287,7 +287,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
287287 move_from_span : Span ,
288288 ty : Ty < ' _ > ,
289289 is_index : Option < bool > ,
290- ) -> Diag < ' tcx > {
290+ ) -> Diag < ' infcx > {
291291 let type_name = match ( & ty. kind ( ) , is_index) {
292292 ( & ty:: Array ( _, _) , Some ( true ) ) | ( & ty:: Array ( _, _) , None ) => "array" ,
293293 ( & ty:: Slice ( _) , _) => "slice" ,
@@ -308,7 +308,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
308308 & self ,
309309 move_from_span : Span ,
310310 container_ty : Ty < ' _ > ,
311- ) -> Diag < ' tcx > {
311+ ) -> Diag < ' infcx > {
312312 struct_span_code_err ! (
313313 self . dcx( ) ,
314314 move_from_span,
@@ -325,7 +325,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
325325 verb : & str ,
326326 optional_adverb_for_moved : & str ,
327327 moved_path : Option < String > ,
328- ) -> Diag < ' tcx > {
328+ ) -> Diag < ' infcx > {
329329 let moved_path = moved_path. map ( |mp| format ! ( ": `{mp}`" ) ) . unwrap_or_default ( ) ;
330330
331331 struct_span_code_err ! (
@@ -344,7 +344,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
344344 span : Span ,
345345 path : & str ,
346346 reason : & str ,
347- ) -> Diag < ' tcx > {
347+ ) -> Diag < ' infcx > {
348348 struct_span_code_err ! (
349349 self . dcx( ) ,
350350 span,
@@ -362,7 +362,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
362362 immutable_place : & str ,
363363 immutable_section : & str ,
364364 action : & str ,
365- ) -> Diag < ' tcx > {
365+ ) -> Diag < ' infcx > {
366366 struct_span_code_err ! (
367367 self . dcx( ) ,
368368 mutate_span,
@@ -380,7 +380,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
380380 & self ,
381381 span : Span ,
382382 yield_span : Span ,
383- ) -> Diag < ' tcx > {
383+ ) -> Diag < ' infcx > {
384384 let coroutine_kind = self . body . coroutine . as_ref ( ) . unwrap ( ) . coroutine_kind ;
385385 struct_span_code_err ! (
386386 self . dcx( ) ,
@@ -391,7 +391,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
391391 . with_span_label ( yield_span, "possible yield occurs here" )
392392 }
393393
394- pub ( crate ) fn cannot_borrow_across_destructor ( & self , borrow_span : Span ) -> Diag < ' tcx > {
394+ pub ( crate ) fn cannot_borrow_across_destructor ( & self , borrow_span : Span ) -> Diag < ' infcx > {
395395 struct_span_code_err ! (
396396 self . dcx( ) ,
397397 borrow_span,
@@ -400,7 +400,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
400400 )
401401 }
402402
403- pub ( crate ) fn path_does_not_live_long_enough ( & self , span : Span , path : & str ) -> Diag < ' tcx > {
403+ pub ( crate ) fn path_does_not_live_long_enough ( & self , span : Span , path : & str ) -> Diag < ' infcx > {
404404 struct_span_code_err ! ( self . dcx( ) , span, E0597 , "{} does not live long enough" , path, )
405405 }
406406
@@ -410,7 +410,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
410410 return_kind : & str ,
411411 reference_desc : & str ,
412412 path_desc : & str ,
413- ) -> Diag < ' tcx > {
413+ ) -> Diag < ' infcx > {
414414 struct_span_code_err ! (
415415 self . dcx( ) ,
416416 span,
@@ -433,7 +433,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
433433 borrowed_path : & str ,
434434 capture_span : Span ,
435435 scope : & str ,
436- ) -> Diag < ' tcx > {
436+ ) -> Diag < ' infcx > {
437437 struct_span_code_err ! (
438438 self . dcx( ) ,
439439 closure_span,
@@ -445,7 +445,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
445445 . with_span_label ( closure_span, format ! ( "may outlive borrowed value {borrowed_path}" ) )
446446 }
447447
448- pub ( crate ) fn thread_local_value_does_not_live_long_enough ( & self , span : Span ) -> Diag < ' tcx > {
448+ pub ( crate ) fn thread_local_value_does_not_live_long_enough ( & self , span : Span ) -> Diag < ' infcx > {
449449 struct_span_code_err ! (
450450 self . dcx( ) ,
451451 span,
@@ -454,7 +454,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
454454 )
455455 }
456456
457- pub ( crate ) fn temporary_value_borrowed_for_too_long ( & self , span : Span ) -> Diag < ' tcx > {
457+ pub ( crate ) fn temporary_value_borrowed_for_too_long ( & self , span : Span ) -> Diag < ' infcx > {
458458 struct_span_code_err ! ( self . dcx( ) , span, E0716 , "temporary value dropped while borrowed" , )
459459 }
460460}
0 commit comments