11use rustc_errors:: {
2- struct_span_err, DiagnosticBuilder , DiagnosticId , DiagnosticMessage , ErrorGuaranteed , MultiSpan ,
2+ struct_span_err, DiagnosticBuilder , DiagnosticId , DiagnosticMessage , MultiSpan ,
33} ;
44use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
55use rustc_span:: Span ;
@@ -12,7 +12,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
1212 place : & str ,
1313 borrow_place : & str ,
1414 value_place : & str ,
15- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
15+ ) -> DiagnosticBuilder < ' tcx > {
1616 self . infcx . tcx . sess . create_err ( crate :: session_diagnostics:: MoveBorrow {
1717 place,
1818 span,
@@ -28,7 +28,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
2828 desc : & str ,
2929 borrow_span : Span ,
3030 borrow_desc : & str ,
31- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
31+ ) -> DiagnosticBuilder < ' tcx > {
3232 let mut err = struct_span_err ! (
3333 self ,
3434 span,
@@ -50,7 +50,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
5050 old_loan_span : Span ,
5151 old_opt_via : & str ,
5252 old_load_end_span : Option < Span > ,
53- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
53+ ) -> DiagnosticBuilder < ' tcx > {
5454 let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
5555 let mut err = struct_span_err ! (
5656 self ,
@@ -97,7 +97,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
9797 desc : & str ,
9898 old_loan_span : Span ,
9999 old_load_end_span : Option < Span > ,
100- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
100+ ) -> DiagnosticBuilder < ' tcx > {
101101 let mut err = struct_span_err ! (
102102 self ,
103103 new_loan_span,
@@ -130,7 +130,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
130130 noun_old : & str ,
131131 old_opt_via : & str ,
132132 previous_end_span : Option < Span > ,
133- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
133+ ) -> DiagnosticBuilder < ' cx > {
134134 let mut err = struct_span_err ! (
135135 self ,
136136 new_loan_span,
@@ -162,7 +162,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
162162 old_opt_via : & str ,
163163 previous_end_span : Option < Span > ,
164164 second_borrow_desc : & str ,
165- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
165+ ) -> DiagnosticBuilder < ' cx > {
166166 let mut err = struct_span_err ! (
167167 self ,
168168 new_loan_span,
@@ -194,7 +194,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
194194 kind_old : & str ,
195195 msg_old : & str ,
196196 old_load_end_span : Option < Span > ,
197- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
197+ ) -> DiagnosticBuilder < ' cx > {
198198 let via = |msg : & str | if msg. is_empty ( ) { "" . to_string ( ) } else { format ! ( " (via {msg})" ) } ;
199199 let mut err = struct_span_err ! (
200200 self ,
@@ -235,7 +235,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
235235 span : Span ,
236236 borrow_span : Span ,
237237 desc : & str ,
238- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
238+ ) -> DiagnosticBuilder < ' cx > {
239239 let mut err = struct_span_err ! (
240240 self ,
241241 span,
@@ -254,24 +254,20 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
254254 span : Span ,
255255 desc : & str ,
256256 is_arg : bool ,
257- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
257+ ) -> DiagnosticBuilder < ' cx > {
258258 let msg = if is_arg { "to immutable argument" } else { "twice to immutable variable" } ;
259259 struct_span_err ! ( self , span, E0384 , "cannot assign {} {}" , msg, desc)
260260 }
261261
262- pub ( crate ) fn cannot_assign (
263- & self ,
264- span : Span ,
265- desc : & str ,
266- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
262+ pub ( crate ) fn cannot_assign ( & self , span : Span , desc : & str ) -> DiagnosticBuilder < ' tcx > {
267263 struct_span_err ! ( self , span, E0594 , "cannot assign to {}" , desc)
268264 }
269265
270266 pub ( crate ) fn cannot_move_out_of (
271267 & self ,
272268 move_from_span : Span ,
273269 move_from_desc : & str ,
274- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
270+ ) -> DiagnosticBuilder < ' cx > {
275271 struct_span_err ! ( self , move_from_span, E0507 , "cannot move out of {}" , move_from_desc)
276272 }
277273
@@ -283,7 +279,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
283279 move_from_span : Span ,
284280 ty : Ty < ' _ > ,
285281 is_index : Option < bool > ,
286- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
282+ ) -> DiagnosticBuilder < ' cx > {
287283 let type_name = match ( & ty. kind ( ) , is_index) {
288284 ( & ty:: Array ( _, _) , Some ( true ) ) | ( & ty:: Array ( _, _) , None ) => "array" ,
289285 ( & ty:: Slice ( _) , _) => "slice" ,
@@ -305,7 +301,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
305301 & self ,
306302 move_from_span : Span ,
307303 container_ty : Ty < ' _ > ,
308- ) -> DiagnosticBuilder < ' cx , ErrorGuaranteed > {
304+ ) -> DiagnosticBuilder < ' cx > {
309305 let mut err = struct_span_err ! (
310306 self ,
311307 move_from_span,
@@ -323,7 +319,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
323319 verb : & str ,
324320 optional_adverb_for_moved : & str ,
325321 moved_path : Option < String > ,
326- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
322+ ) -> DiagnosticBuilder < ' tcx > {
327323 let moved_path = moved_path. map ( |mp| format ! ( ": `{mp}`" ) ) . unwrap_or_default ( ) ;
328324
329325 struct_span_err ! (
@@ -342,7 +338,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
342338 span : Span ,
343339 path : & str ,
344340 reason : & str ,
345- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
341+ ) -> DiagnosticBuilder < ' tcx > {
346342 struct_span_err ! ( self , span, E0596 , "cannot borrow {} as mutable{}" , path, reason, )
347343 }
348344
@@ -353,7 +349,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
353349 immutable_place : & str ,
354350 immutable_section : & str ,
355351 action : & str ,
356- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
352+ ) -> DiagnosticBuilder < ' tcx > {
357353 let mut err = struct_span_err ! (
358354 self ,
359355 mutate_span,
@@ -372,7 +368,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
372368 & self ,
373369 span : Span ,
374370 yield_span : Span ,
375- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
371+ ) -> DiagnosticBuilder < ' tcx > {
376372 let coroutine_kind = self . body . coroutine . as_ref ( ) . unwrap ( ) . coroutine_kind ;
377373 let mut err = struct_span_err ! (
378374 self ,
@@ -387,7 +383,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
387383 pub ( crate ) fn cannot_borrow_across_destructor (
388384 & self ,
389385 borrow_span : Span ,
390- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
386+ ) -> DiagnosticBuilder < ' tcx > {
391387 struct_span_err ! (
392388 self ,
393389 borrow_span,
@@ -400,7 +396,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
400396 & self ,
401397 span : Span ,
402398 path : & str ,
403- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
399+ ) -> DiagnosticBuilder < ' tcx > {
404400 struct_span_err ! ( self , span, E0597 , "{} does not live long enough" , path, )
405401 }
406402
@@ -410,7 +406,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
410406 return_kind : & str ,
411407 reference_desc : & str ,
412408 path_desc : & str ,
413- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
409+ ) -> DiagnosticBuilder < ' tcx > {
414410 let mut err = struct_span_err ! (
415411 self ,
416412 span,
@@ -436,7 +432,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
436432 borrowed_path : & str ,
437433 capture_span : Span ,
438434 scope : & str ,
439- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
435+ ) -> DiagnosticBuilder < ' tcx > {
440436 let mut err = struct_span_err ! (
441437 self ,
442438 closure_span,
@@ -452,14 +448,14 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
452448 pub ( crate ) fn thread_local_value_does_not_live_long_enough (
453449 & self ,
454450 span : Span ,
455- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
451+ ) -> DiagnosticBuilder < ' tcx > {
456452 struct_span_err ! ( self , span, E0712 , "thread-local variable borrowed past end of function" , )
457453 }
458454
459455 pub ( crate ) fn temporary_value_borrowed_for_too_long (
460456 & self ,
461457 span : Span ,
462- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
458+ ) -> DiagnosticBuilder < ' tcx > {
463459 struct_span_err ! ( self , span, E0716 , "temporary value dropped while borrowed" , )
464460 }
465461
@@ -470,7 +466,7 @@ impl<'cx, 'tcx> crate::MirBorrowckCtxt<'cx, 'tcx> {
470466 sp : S ,
471467 msg : impl Into < DiagnosticMessage > ,
472468 code : DiagnosticId ,
473- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
469+ ) -> DiagnosticBuilder < ' tcx > {
474470 self . infcx . tcx . sess . struct_span_err_with_code ( sp, msg, code)
475471 }
476472}
@@ -479,7 +475,7 @@ pub(crate) fn borrowed_data_escapes_closure<'tcx>(
479475 tcx : TyCtxt < ' tcx > ,
480476 escape_span : Span ,
481477 escapes_from : & str ,
482- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
478+ ) -> DiagnosticBuilder < ' tcx > {
483479 struct_span_err ! (
484480 tcx. sess,
485481 escape_span,
0 commit comments