11#![ allow( rustc:: diagnostic_outside_of_impl) ]
22#![ allow( rustc:: untranslatable_diagnostic) ]
33
4- use rustc_errors:: { codes:: * , struct_span_code_err, DiagCtxt , DiagnosticBuilder } ;
4+ use rustc_errors:: { codes:: * , struct_span_code_err, Diag , DiagCtxt } ;
55use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
66use rustc_span:: Span ;
77
@@ -17,7 +17,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
1717 place : & str ,
1818 borrow_place : & str ,
1919 value_place : & str ,
20- ) -> DiagnosticBuilder < ' tcx > {
20+ ) -> Diag < ' tcx > {
2121 self . dcx ( ) . create_err ( crate :: session_diagnostics:: MoveBorrow {
2222 place,
2323 span,
@@ -33,7 +33,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
3333 desc : & str ,
3434 borrow_span : Span ,
3535 borrow_desc : & str ,
36- ) -> DiagnosticBuilder < ' tcx > {
36+ ) -> Diag < ' tcx > {
3737 struct_span_code_err ! (
3838 self . dcx( ) ,
3939 span,
@@ -53,7 +53,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
5353 old_loan_span : Span ,
5454 old_opt_via : & str ,
5555 old_load_end_span : Option < Span > ,
56- ) -> DiagnosticBuilder < ' tcx > {
56+ ) -> Diag < ' tcx > {
5757 let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
5858 let mut err = struct_span_code_err ! (
5959 self . dcx( ) ,
@@ -100,7 +100,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
100100 desc : & str ,
101101 old_loan_span : Span ,
102102 old_load_end_span : Option < Span > ,
103- ) -> DiagnosticBuilder < ' tcx > {
103+ ) -> Diag < ' tcx > {
104104 let mut err = struct_span_code_err ! (
105105 self . dcx( ) ,
106106 new_loan_span,
@@ -133,7 +133,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
133133 noun_old : & str ,
134134 old_opt_via : & str ,
135135 previous_end_span : Option < Span > ,
136- ) -> DiagnosticBuilder < ' tcx > {
136+ ) -> Diag < ' tcx > {
137137 let mut err = struct_span_code_err ! (
138138 self . dcx( ) ,
139139 new_loan_span,
@@ -165,7 +165,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
165165 old_opt_via : & str ,
166166 previous_end_span : Option < Span > ,
167167 second_borrow_desc : & str ,
168- ) -> DiagnosticBuilder < ' tcx > {
168+ ) -> Diag < ' tcx > {
169169 let mut err = struct_span_code_err ! (
170170 self . dcx( ) ,
171171 new_loan_span,
@@ -197,7 +197,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
197197 kind_old : & str ,
198198 msg_old : & str ,
199199 old_load_end_span : Option < Span > ,
200- ) -> DiagnosticBuilder < ' tcx > {
200+ ) -> Diag < ' tcx > {
201201 let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
202202 let mut err = struct_span_code_err ! (
203203 self . dcx( ) ,
@@ -238,7 +238,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
238238 span : Span ,
239239 borrow_span : Span ,
240240 desc : & str ,
241- ) -> DiagnosticBuilder < ' tcx > {
241+ ) -> Diag < ' tcx > {
242242 struct_span_code_err ! (
243243 self . dcx( ) ,
244244 span,
@@ -255,20 +255,20 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
255255 span : Span ,
256256 desc : & str ,
257257 is_arg : bool ,
258- ) -> DiagnosticBuilder < ' tcx > {
258+ ) -> Diag < ' tcx > {
259259 let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" } ;
260260 struct_span_code_err ! ( self . dcx( ) , span, E0384 , "cannot assign {} {}" , msg, desc)
261261 }
262262
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 > {
264264 struct_span_code_err ! ( self . dcx( ) , span, E0594 , "cannot assign to {}" , desc)
265265 }
266266
267267 pub ( crate ) fn cannot_move_out_of (
268268 & self ,
269269 move_from_span : Span ,
270270 move_from_desc : & str ,
271- ) -> DiagnosticBuilder < ' tcx > {
271+ ) -> Diag < ' tcx > {
272272 struct_span_code_err ! (
273273 self . dcx( ) ,
274274 move_from_span,
@@ -286,7 +286,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
286286 move_from_span : Span ,
287287 ty : Ty < ' _ > ,
288288 is_index : Option < bool > ,
289- ) -> DiagnosticBuilder < ' tcx > {
289+ ) -> Diag < ' tcx > {
290290 let type_name = match ( & ty. kind ( ) , is_index) {
291291 ( & ty:: Array ( _, _) , Some ( true ) ) | ( & ty:: Array ( _, _) , None ) => "array" ,
292292 ( & ty:: Slice ( _) , _) => "slice" ,
@@ -307,7 +307,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
307307 & self ,
308308 move_from_span : Span ,
309309 container_ty : Ty < ' _ > ,
310- ) -> DiagnosticBuilder < ' tcx > {
310+ ) -> Diag < ' tcx > {
311311 struct_span_code_err ! (
312312 self . dcx( ) ,
313313 move_from_span,
@@ -324,7 +324,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
324324 verb : & str ,
325325 optional_adverb_for_moved : & str ,
326326 moved_path : Option < String > ,
327- ) -> DiagnosticBuilder < ' tcx > {
327+ ) -> Diag < ' tcx > {
328328 let moved_path = moved_path. map ( |mp| format ! ( ": `{mp}`" ) ) . unwrap_or_default ( ) ;
329329
330330 struct_span_code_err ! (
@@ -343,7 +343,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
343343 span : Span ,
344344 path : & str ,
345345 reason : & str ,
346- ) -> DiagnosticBuilder < ' tcx > {
346+ ) -> Diag < ' tcx > {
347347 struct_span_code_err ! (
348348 self . dcx( ) ,
349349 span,
@@ -361,7 +361,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
361361 immutable_place : & str ,
362362 immutable_section : & str ,
363363 action : & str ,
364- ) -> DiagnosticBuilder < ' tcx > {
364+ ) -> Diag < ' tcx > {
365365 struct_span_code_err ! (
366366 self . dcx( ) ,
367367 mutate_span,
@@ -379,7 +379,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
379379 & self ,
380380 span : Span ,
381381 yield_span : Span ,
382- ) -> DiagnosticBuilder < ' tcx > {
382+ ) -> Diag < ' tcx > {
383383 let coroutine_kind = self . body . coroutine . as_ref ( ) . unwrap ( ) . coroutine_kind ;
384384 struct_span_code_err ! (
385385 self . dcx( ) ,
@@ -390,10 +390,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
390390 . with_span_label ( yield_span, "possible yield occurs here" )
391391 }
392392
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 > {
397394 struct_span_code_err ! (
398395 self . dcx( ) ,
399396 borrow_span,
@@ -402,11 +399,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
402399 )
403400 }
404401
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 > {
410403 struct_span_code_err ! ( self . dcx( ) , span, E0597 , "{} does not live long enough" , path, )
411404 }
412405
@@ -416,7 +409,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
416409 return_kind : & str ,
417410 reference_desc : & str ,
418411 path_desc : & str ,
419- ) -> DiagnosticBuilder < ' tcx > {
412+ ) -> Diag < ' tcx > {
420413 struct_span_code_err ! (
421414 self . dcx( ) ,
422415 span,
@@ -439,7 +432,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
439432 borrowed_path : & str ,
440433 capture_span : Span ,
441434 scope : & str ,
442- ) -> DiagnosticBuilder < ' tcx > {
435+ ) -> Diag < ' tcx > {
443436 struct_span_code_err ! (
444437 self . dcx( ) ,
445438 closure_span,
@@ -451,10 +444,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
451444 . with_span_label ( closure_span, format ! ( "may outlive borrowed value {borrowed_path}" ) )
452445 }
453446
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 > {
458448 struct_span_code_err ! (
459449 self . dcx( ) ,
460450 span,
@@ -463,10 +453,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
463453 )
464454 }
465455
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 > {
470457 struct_span_code_err ! ( self . dcx( ) , span, E0716 , "temporary value dropped while borrowed" , )
471458 }
472459}
@@ -475,7 +462,7 @@ pub(crate) fn borrowed_data_escapes_closure<'tcx>(
475462 tcx : TyCtxt < ' tcx > ,
476463 escape_span : Span ,
477464 escapes_from : & str ,
478- ) -> DiagnosticBuilder < ' tcx > {
465+ ) -> Diag < ' tcx > {
479466 struct_span_code_err ! (
480467 tcx. dcx( ) ,
481468 escape_span,
0 commit comments