1- use rustc_errors:: { struct_span_err, DiagnosticBuilder , DiagnosticId , ErrorReported } ;
1+ use rustc_errors:: { struct_span_err, DiagnosticBuilder , DiagnosticId , ErrorGuaranteed } ;
22use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
33use rustc_span:: { MultiSpan , Span } ;
44
@@ -7,7 +7,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
77 & self ,
88 span : Span ,
99 desc : & str ,
10- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
10+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
1111 struct_span_err ! ( self , span, E0505 , "cannot move out of {} because it is borrowed" , desc, )
1212 }
1313
@@ -17,7 +17,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
1717 desc : & str ,
1818 borrow_span : Span ,
1919 borrow_desc : & str ,
20- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
20+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
2121 let mut err = struct_span_err ! (
2222 self ,
2323 span,
@@ -36,7 +36,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
3636 span : Span ,
3737 verb : & str ,
3838 desc : & str ,
39- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
39+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
4040 struct_span_err ! (
4141 self ,
4242 span,
@@ -55,7 +55,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
5555 old_loan_span : Span ,
5656 old_opt_via : & str ,
5757 old_load_end_span : Option < Span > ,
58- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
58+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
5959 let via =
6060 |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {})" , msg) } ;
6161 let mut err = struct_span_err ! (
@@ -103,7 +103,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
103103 desc : & str ,
104104 old_loan_span : Span ,
105105 old_load_end_span : Option < Span > ,
106- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
106+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
107107 let mut err = struct_span_err ! (
108108 self ,
109109 new_loan_span,
@@ -136,7 +136,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
136136 noun_old : & str ,
137137 old_opt_via : & str ,
138138 previous_end_span : Option < Span > ,
139- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
139+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
140140 let mut err = struct_span_err ! (
141141 self ,
142142 new_loan_span,
@@ -168,7 +168,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
168168 old_opt_via : & str ,
169169 previous_end_span : Option < Span > ,
170170 second_borrow_desc : & str ,
171- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
171+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
172172 let mut err = struct_span_err ! (
173173 self ,
174174 new_loan_span,
@@ -204,7 +204,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
204204 kind_old : & str ,
205205 msg_old : & str ,
206206 old_load_end_span : Option < Span > ,
207- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
207+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
208208 let via =
209209 |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {})" , msg) } ;
210210 let mut err = struct_span_err ! (
@@ -247,7 +247,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
247247 span : Span ,
248248 borrow_span : Span ,
249249 desc : & str ,
250- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
250+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
251251 let mut err = struct_span_err ! (
252252 self ,
253253 span,
@@ -266,20 +266,24 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
266266 span : Span ,
267267 desc : & str ,
268268 is_arg : bool ,
269- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
269+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
270270 let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" } ;
271271 struct_span_err ! ( self , span, E0384 , "cannot assign {} {}" , msg, desc)
272272 }
273273
274- crate fn cannot_assign ( & self , span : Span , desc : & str ) -> DiagnosticBuilder < ' cx , ErrorReported > {
274+ crate fn cannot_assign (
275+ & self ,
276+ span : Span ,
277+ desc : & str ,
278+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
275279 struct_span_err ! ( self , span, E0594 , "cannot assign to {}" , desc)
276280 }
277281
278282 crate fn cannot_move_out_of (
279283 & self ,
280284 move_from_span : Span ,
281285 move_from_desc : & str ,
282- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
286+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
283287 struct_span_err ! ( self , move_from_span, E0507 , "cannot move out of {}" , move_from_desc, )
284288 }
285289
@@ -291,7 +295,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
291295 move_from_span : Span ,
292296 ty : Ty < ' _ > ,
293297 is_index : Option < bool > ,
294- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
298+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
295299 let type_name = match ( & ty. kind ( ) , is_index) {
296300 ( & ty:: Array ( _, _) , Some ( true ) ) | ( & ty:: Array ( _, _) , None ) => "array" ,
297301 ( & ty:: Slice ( _) , _) => "slice" ,
@@ -313,7 +317,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
313317 & self ,
314318 move_from_span : Span ,
315319 container_ty : Ty < ' _ > ,
316- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
320+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
317321 let mut err = struct_span_err ! (
318322 self ,
319323 move_from_span,
@@ -331,7 +335,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
331335 verb : & str ,
332336 optional_adverb_for_moved : & str ,
333337 moved_path : Option < String > ,
334- ) -> DiagnosticBuilder < ' tcx , ErrorReported > {
338+ ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
335339 let moved_path = moved_path. map ( |mp| format ! ( ": `{}`" , mp) ) . unwrap_or_default ( ) ;
336340
337341 struct_span_err ! (
@@ -350,7 +354,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
350354 span : Span ,
351355 path : & str ,
352356 reason : & str ,
353- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
357+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
354358 struct_span_err ! ( self , span, E0596 , "cannot borrow {} as mutable{}" , path, reason, )
355359 }
356360
@@ -361,7 +365,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
361365 immutable_place : & str ,
362366 immutable_section : & str ,
363367 action : & str ,
364- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
368+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
365369 let mut err = struct_span_err ! (
366370 self ,
367371 mutate_span,
@@ -380,7 +384,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
380384 & self ,
381385 span : Span ,
382386 yield_span : Span ,
383- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
387+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
384388 let mut err = struct_span_err ! (
385389 self ,
386390 span,
@@ -394,7 +398,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
394398 crate fn cannot_borrow_across_destructor (
395399 & self ,
396400 borrow_span : Span ,
397- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
401+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
398402 struct_span_err ! (
399403 self ,
400404 borrow_span,
@@ -407,7 +411,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
407411 & self ,
408412 span : Span ,
409413 path : & str ,
410- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
414+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
411415 struct_span_err ! ( self , span, E0597 , "{} does not live long enough" , path, )
412416 }
413417
@@ -417,7 +421,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
417421 return_kind : & str ,
418422 reference_desc : & str ,
419423 path_desc : & str ,
420- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
424+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
421425 let mut err = struct_span_err ! (
422426 self ,
423427 span,
@@ -442,7 +446,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
442446 closure_kind : & str ,
443447 borrowed_path : & str ,
444448 capture_span : Span ,
445- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
449+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
446450 let mut err = struct_span_err ! (
447451 self ,
448452 closure_span,
@@ -461,14 +465,14 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
461465 crate fn thread_local_value_does_not_live_long_enough (
462466 & self ,
463467 span : Span ,
464- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
468+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
465469 struct_span_err ! ( self , span, E0712 , "thread-local variable borrowed past end of function" , )
466470 }
467471
468472 crate fn temporary_value_borrowed_for_too_long (
469473 & self ,
470474 span : Span ,
471- ) -> DiagnosticBuilder < ' cx , ErrorReported > {
475+ ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
472476 struct_span_err ! ( self , span, E0716 , "temporary value dropped while borrowed" , )
473477 }
474478
@@ -477,7 +481,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
477481 sp : S ,
478482 msg : & str ,
479483 code : DiagnosticId ,
480- ) -> DiagnosticBuilder < ' tcx , ErrorReported > {
484+ ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
481485 self . infcx . tcx . sess . struct_span_err_with_code ( sp, msg, code)
482486 }
483487}
@@ -486,7 +490,7 @@ crate fn borrowed_data_escapes_closure<'tcx>(
486490 tcx : TyCtxt < ' tcx > ,
487491 escape_span : Span ,
488492 escapes_from : & str ,
489- ) -> DiagnosticBuilder < ' tcx , ErrorReported > {
493+ ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
490494 struct_span_err ! (
491495 tcx. sess,
492496 escape_span,
0 commit comments