@@ -6,8 +6,8 @@ use rustc_middle::span_bug;
6
6
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
7
7
use rustc_span:: Span ;
8
8
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 > {
11
11
self . infcx . dcx ( )
12
12
}
13
13
@@ -18,7 +18,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
18
18
place : & str ,
19
19
borrow_place : & str ,
20
20
value_place : & str ,
21
- ) -> Diag < ' tcx > {
21
+ ) -> Diag < ' infcx > {
22
22
self . dcx ( ) . create_err ( crate :: session_diagnostics:: MoveBorrow {
23
23
place,
24
24
span,
@@ -34,7 +34,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
34
34
desc : & str ,
35
35
borrow_span : Span ,
36
36
borrow_desc : & str ,
37
- ) -> Diag < ' tcx > {
37
+ ) -> Diag < ' infcx > {
38
38
struct_span_code_err ! (
39
39
self . dcx( ) ,
40
40
span,
@@ -54,7 +54,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
54
54
old_loan_span : Span ,
55
55
old_opt_via : & str ,
56
56
old_load_end_span : Option < Span > ,
57
- ) -> Diag < ' tcx > {
57
+ ) -> Diag < ' infcx > {
58
58
let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
59
59
let mut err = struct_span_code_err ! (
60
60
self . dcx( ) ,
@@ -101,7 +101,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
101
101
desc : & str ,
102
102
old_loan_span : Span ,
103
103
old_load_end_span : Option < Span > ,
104
- ) -> Diag < ' tcx > {
104
+ ) -> Diag < ' infcx > {
105
105
let mut err = struct_span_code_err ! (
106
106
self . dcx( ) ,
107
107
new_loan_span,
@@ -134,7 +134,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
134
134
noun_old : & str ,
135
135
old_opt_via : & str ,
136
136
previous_end_span : Option < Span > ,
137
- ) -> Diag < ' tcx > {
137
+ ) -> Diag < ' infcx > {
138
138
let mut err = struct_span_code_err ! (
139
139
self . dcx( ) ,
140
140
new_loan_span,
@@ -166,7 +166,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
166
166
old_opt_via : & str ,
167
167
previous_end_span : Option < Span > ,
168
168
second_borrow_desc : & str ,
169
- ) -> Diag < ' tcx > {
169
+ ) -> Diag < ' infcx > {
170
170
let mut err = struct_span_code_err ! (
171
171
self . dcx( ) ,
172
172
new_loan_span,
@@ -198,7 +198,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
198
198
kind_old : & str ,
199
199
msg_old : & str ,
200
200
old_load_end_span : Option < Span > ,
201
- ) -> Diag < ' tcx > {
201
+ ) -> Diag < ' infcx > {
202
202
let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
203
203
let mut err = struct_span_code_err ! (
204
204
self . dcx( ) ,
@@ -239,7 +239,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
239
239
span : Span ,
240
240
borrow_span : Span ,
241
241
desc : & str ,
242
- ) -> Diag < ' tcx > {
242
+ ) -> Diag < ' infcx > {
243
243
struct_span_code_err ! (
244
244
self . dcx( ) ,
245
245
span,
@@ -256,20 +256,20 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
256
256
span : Span ,
257
257
desc : & str ,
258
258
is_arg : bool ,
259
- ) -> Diag < ' tcx > {
259
+ ) -> Diag < ' infcx > {
260
260
let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" } ;
261
261
struct_span_code_err ! ( self . dcx( ) , span, E0384 , "cannot assign {} {}" , msg, desc)
262
262
}
263
263
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 > {
265
265
struct_span_code_err ! ( self . dcx( ) , span, E0594 , "cannot assign to {}" , desc)
266
266
}
267
267
268
268
pub ( crate ) fn cannot_move_out_of (
269
269
& self ,
270
270
move_from_span : Span ,
271
271
move_from_desc : & str ,
272
- ) -> Diag < ' tcx > {
272
+ ) -> Diag < ' infcx > {
273
273
struct_span_code_err ! (
274
274
self . dcx( ) ,
275
275
move_from_span,
@@ -287,7 +287,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
287
287
move_from_span : Span ,
288
288
ty : Ty < ' _ > ,
289
289
is_index : Option < bool > ,
290
- ) -> Diag < ' tcx > {
290
+ ) -> Diag < ' infcx > {
291
291
let type_name = match ( & ty. kind ( ) , is_index) {
292
292
( & ty:: Array ( _, _) , Some ( true ) ) | ( & ty:: Array ( _, _) , None ) => "array" ,
293
293
( & ty:: Slice ( _) , _) => "slice" ,
@@ -308,7 +308,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
308
308
& self ,
309
309
move_from_span : Span ,
310
310
container_ty : Ty < ' _ > ,
311
- ) -> Diag < ' tcx > {
311
+ ) -> Diag < ' infcx > {
312
312
struct_span_code_err ! (
313
313
self . dcx( ) ,
314
314
move_from_span,
@@ -325,7 +325,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
325
325
verb : & str ,
326
326
optional_adverb_for_moved : & str ,
327
327
moved_path : Option < String > ,
328
- ) -> Diag < ' tcx > {
328
+ ) -> Diag < ' infcx > {
329
329
let moved_path = moved_path. map ( |mp| format ! ( ": `{mp}`" ) ) . unwrap_or_default ( ) ;
330
330
331
331
struct_span_code_err ! (
@@ -344,7 +344,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
344
344
span : Span ,
345
345
path : & str ,
346
346
reason : & str ,
347
- ) -> Diag < ' tcx > {
347
+ ) -> Diag < ' infcx > {
348
348
struct_span_code_err ! (
349
349
self . dcx( ) ,
350
350
span,
@@ -362,7 +362,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
362
362
immutable_place : & str ,
363
363
immutable_section : & str ,
364
364
action : & str ,
365
- ) -> Diag < ' tcx > {
365
+ ) -> Diag < ' infcx > {
366
366
struct_span_code_err ! (
367
367
self . dcx( ) ,
368
368
mutate_span,
@@ -380,7 +380,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
380
380
& self ,
381
381
span : Span ,
382
382
yield_span : Span ,
383
- ) -> Diag < ' tcx > {
383
+ ) -> Diag < ' infcx > {
384
384
let coroutine_kind = self . body . coroutine . as_ref ( ) . unwrap ( ) . coroutine_kind ;
385
385
struct_span_code_err ! (
386
386
self . dcx( ) ,
@@ -391,7 +391,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
391
391
. with_span_label ( yield_span, "possible yield occurs here" )
392
392
}
393
393
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 > {
395
395
struct_span_code_err ! (
396
396
self . dcx( ) ,
397
397
borrow_span,
@@ -400,7 +400,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
400
400
)
401
401
}
402
402
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 > {
404
404
struct_span_code_err ! ( self . dcx( ) , span, E0597 , "{} does not live long enough" , path, )
405
405
}
406
406
@@ -410,7 +410,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
410
410
return_kind : & str ,
411
411
reference_desc : & str ,
412
412
path_desc : & str ,
413
- ) -> Diag < ' tcx > {
413
+ ) -> Diag < ' infcx > {
414
414
struct_span_code_err ! (
415
415
self . dcx( ) ,
416
416
span,
@@ -433,7 +433,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
433
433
borrowed_path : & str ,
434
434
capture_span : Span ,
435
435
scope : & str ,
436
- ) -> Diag < ' tcx > {
436
+ ) -> Diag < ' infcx > {
437
437
struct_span_code_err ! (
438
438
self . dcx( ) ,
439
439
closure_span,
@@ -445,7 +445,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
445
445
. with_span_label ( closure_span, format ! ( "may outlive borrowed value {borrowed_path}" ) )
446
446
}
447
447
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 > {
449
449
struct_span_code_err ! (
450
450
self . dcx( ) ,
451
451
span,
@@ -454,7 +454,7 @@ impl<'tcx> crate::MirBorrowckCtxt<'_, '_, '_, 'tcx> {
454
454
)
455
455
}
456
456
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 > {
458
458
struct_span_code_err ! ( self . dcx( ) , span, E0716 , "temporary value dropped while borrowed" , )
459
459
}
460
460
}
0 commit comments