1
1
#![ allow( rustc:: diagnostic_outside_of_impl) ]
2
2
#![ allow( rustc:: untranslatable_diagnostic) ]
3
3
4
- use rustc_errors:: { codes:: * , struct_span_code_err, DiagCtxt , DiagnosticBuilder } ;
4
+ use rustc_errors:: { codes:: * , struct_span_code_err, Diag , DiagCtxt } ;
5
5
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
6
6
use rustc_span:: Span ;
7
7
@@ -17,7 +17,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
17
17
place : & str ,
18
18
borrow_place : & str ,
19
19
value_place : & str ,
20
- ) -> DiagnosticBuilder < ' tcx > {
20
+ ) -> Diag < ' tcx > {
21
21
self . dcx ( ) . create_err ( crate :: session_diagnostics:: MoveBorrow {
22
22
place,
23
23
span,
@@ -33,7 +33,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
33
33
desc : & str ,
34
34
borrow_span : Span ,
35
35
borrow_desc : & str ,
36
- ) -> DiagnosticBuilder < ' tcx > {
36
+ ) -> Diag < ' tcx > {
37
37
struct_span_code_err ! (
38
38
self . dcx( ) ,
39
39
span,
@@ -53,7 +53,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
53
53
old_loan_span : Span ,
54
54
old_opt_via : & str ,
55
55
old_load_end_span : Option < Span > ,
56
- ) -> DiagnosticBuilder < ' tcx > {
56
+ ) -> Diag < ' tcx > {
57
57
let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
58
58
let mut err = struct_span_code_err ! (
59
59
self . dcx( ) ,
@@ -100,7 +100,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
100
100
desc : & str ,
101
101
old_loan_span : Span ,
102
102
old_load_end_span : Option < Span > ,
103
- ) -> DiagnosticBuilder < ' tcx > {
103
+ ) -> Diag < ' tcx > {
104
104
let mut err = struct_span_code_err ! (
105
105
self . dcx( ) ,
106
106
new_loan_span,
@@ -133,7 +133,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
133
133
noun_old : & str ,
134
134
old_opt_via : & str ,
135
135
previous_end_span : Option < Span > ,
136
- ) -> DiagnosticBuilder < ' tcx > {
136
+ ) -> Diag < ' tcx > {
137
137
let mut err = struct_span_code_err ! (
138
138
self . dcx( ) ,
139
139
new_loan_span,
@@ -165,7 +165,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
165
165
old_opt_via : & str ,
166
166
previous_end_span : Option < Span > ,
167
167
second_borrow_desc : & str ,
168
- ) -> DiagnosticBuilder < ' tcx > {
168
+ ) -> Diag < ' tcx > {
169
169
let mut err = struct_span_code_err ! (
170
170
self . dcx( ) ,
171
171
new_loan_span,
@@ -197,7 +197,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
197
197
kind_old : & str ,
198
198
msg_old : & str ,
199
199
old_load_end_span : Option < Span > ,
200
- ) -> DiagnosticBuilder < ' tcx > {
200
+ ) -> Diag < ' tcx > {
201
201
let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
202
202
let mut err = struct_span_code_err ! (
203
203
self . dcx( ) ,
@@ -238,7 +238,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
238
238
span : Span ,
239
239
borrow_span : Span ,
240
240
desc : & str ,
241
- ) -> DiagnosticBuilder < ' tcx > {
241
+ ) -> Diag < ' tcx > {
242
242
struct_span_code_err ! (
243
243
self . dcx( ) ,
244
244
span,
@@ -255,20 +255,20 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
255
255
span : Span ,
256
256
desc : & str ,
257
257
is_arg : bool ,
258
- ) -> DiagnosticBuilder < ' tcx > {
258
+ ) -> Diag < ' tcx > {
259
259
let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" } ;
260
260
struct_span_code_err ! ( self . dcx( ) , span, E0384 , "cannot assign {} {}" , msg, desc)
261
261
}
262
262
263
- pub ( crate ) fn cannot_assign ( & self , span : Span , desc : & str ) -> DiagnosticBuilder < ' tcx > {
263
+ pub ( crate ) fn cannot_assign ( & self , span : Span , desc : & str ) -> Diag < ' tcx > {
264
264
struct_span_code_err ! ( self . dcx( ) , span, E0594 , "cannot assign to {}" , desc)
265
265
}
266
266
267
267
pub ( crate ) fn cannot_move_out_of (
268
268
& self ,
269
269
move_from_span : Span ,
270
270
move_from_desc : & str ,
271
- ) -> DiagnosticBuilder < ' tcx > {
271
+ ) -> Diag < ' tcx > {
272
272
struct_span_code_err ! (
273
273
self . dcx( ) ,
274
274
move_from_span,
@@ -286,7 +286,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
286
286
move_from_span : Span ,
287
287
ty : Ty < ' _ > ,
288
288
is_index : Option < bool > ,
289
- ) -> DiagnosticBuilder < ' tcx > {
289
+ ) -> Diag < ' tcx > {
290
290
let type_name = match ( & ty. kind ( ) , is_index) {
291
291
( & ty:: Array ( _, _) , Some ( true ) ) | ( & ty:: Array ( _, _) , None ) => "array" ,
292
292
( & ty:: Slice ( _) , _) => "slice" ,
@@ -307,7 +307,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
307
307
& self ,
308
308
move_from_span : Span ,
309
309
container_ty : Ty < ' _ > ,
310
- ) -> DiagnosticBuilder < ' tcx > {
310
+ ) -> Diag < ' tcx > {
311
311
struct_span_code_err ! (
312
312
self . dcx( ) ,
313
313
move_from_span,
@@ -324,7 +324,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
324
324
verb : & str ,
325
325
optional_adverb_for_moved : & str ,
326
326
moved_path : Option < String > ,
327
- ) -> DiagnosticBuilder < ' tcx > {
327
+ ) -> Diag < ' tcx > {
328
328
let moved_path = moved_path. map ( |mp| format ! ( ": `{mp}`" ) ) . unwrap_or_default ( ) ;
329
329
330
330
struct_span_code_err ! (
@@ -343,7 +343,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
343
343
span : Span ,
344
344
path : & str ,
345
345
reason : & str ,
346
- ) -> DiagnosticBuilder < ' tcx > {
346
+ ) -> Diag < ' tcx > {
347
347
struct_span_code_err ! (
348
348
self . dcx( ) ,
349
349
span,
@@ -361,7 +361,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
361
361
immutable_place : & str ,
362
362
immutable_section : & str ,
363
363
action : & str ,
364
- ) -> DiagnosticBuilder < ' tcx > {
364
+ ) -> Diag < ' tcx > {
365
365
struct_span_code_err ! (
366
366
self . dcx( ) ,
367
367
mutate_span,
@@ -379,7 +379,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
379
379
& self ,
380
380
span : Span ,
381
381
yield_span : Span ,
382
- ) -> DiagnosticBuilder < ' tcx > {
382
+ ) -> Diag < ' tcx > {
383
383
let coroutine_kind = self . body . coroutine . as_ref ( ) . unwrap ( ) . coroutine_kind ;
384
384
struct_span_code_err ! (
385
385
self . dcx( ) ,
@@ -390,10 +390,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
390
390
. with_span_label ( yield_span, "possible yield occurs here" )
391
391
}
392
392
393
- pub ( crate ) fn cannot_borrow_across_destructor (
394
- & self ,
395
- borrow_span : Span ,
396
- ) -> DiagnosticBuilder < ' tcx > {
393
+ pub ( crate ) fn cannot_borrow_across_destructor ( & self , borrow_span : Span ) -> Diag < ' tcx > {
397
394
struct_span_code_err ! (
398
395
self . dcx( ) ,
399
396
borrow_span,
@@ -402,11 +399,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
402
399
)
403
400
}
404
401
405
- pub ( crate ) fn path_does_not_live_long_enough (
406
- & self ,
407
- span : Span ,
408
- path : & str ,
409
- ) -> DiagnosticBuilder < ' tcx > {
402
+ pub ( crate ) fn path_does_not_live_long_enough ( & self , span : Span , path : & str ) -> Diag < ' tcx > {
410
403
struct_span_code_err ! ( self . dcx( ) , span, E0597 , "{} does not live long enough" , path, )
411
404
}
412
405
@@ -416,7 +409,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
416
409
return_kind : & str ,
417
410
reference_desc : & str ,
418
411
path_desc : & str ,
419
- ) -> DiagnosticBuilder < ' tcx > {
412
+ ) -> Diag < ' tcx > {
420
413
struct_span_code_err ! (
421
414
self . dcx( ) ,
422
415
span,
@@ -439,7 +432,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
439
432
borrowed_path : & str ,
440
433
capture_span : Span ,
441
434
scope : & str ,
442
- ) -> DiagnosticBuilder < ' tcx > {
435
+ ) -> Diag < ' tcx > {
443
436
struct_span_code_err ! (
444
437
self . dcx( ) ,
445
438
closure_span,
@@ -451,10 +444,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
451
444
. with_span_label ( closure_span, format ! ( "may outlive borrowed value {borrowed_path}" ) )
452
445
}
453
446
454
- pub ( crate ) fn thread_local_value_does_not_live_long_enough (
455
- & self ,
456
- span : Span ,
457
- ) -> DiagnosticBuilder < ' tcx > {
447
+ pub ( crate ) fn thread_local_value_does_not_live_long_enough ( & self , span : Span ) -> Diag < ' tcx > {
458
448
struct_span_code_err ! (
459
449
self . dcx( ) ,
460
450
span,
@@ -463,10 +453,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
463
453
)
464
454
}
465
455
466
- pub ( crate ) fn temporary_value_borrowed_for_too_long (
467
- & self ,
468
- span : Span ,
469
- ) -> DiagnosticBuilder < ' tcx > {
456
+ pub ( crate ) fn temporary_value_borrowed_for_too_long ( & self , span : Span ) -> Diag < ' tcx > {
470
457
struct_span_code_err ! ( self . dcx( ) , span, E0716 , "temporary value dropped while borrowed" , )
471
458
}
472
459
}
@@ -475,7 +462,7 @@ pub(crate) fn borrowed_data_escapes_closure<'tcx>(
475
462
tcx : TyCtxt < ' tcx > ,
476
463
escape_span : Span ,
477
464
escapes_from : & str ,
478
- ) -> DiagnosticBuilder < ' tcx > {
465
+ ) -> Diag < ' tcx > {
479
466
struct_span_code_err ! (
480
467
tcx. dcx( ) ,
481
468
escape_span,
0 commit comments