@@ -2972,21 +2972,27 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
29722972 }
29732973 }
29742974
2975- let mut err = self . path_does_not_live_long_enough ( borrow_span, & format ! ( "`{name}`" ) ) ;
2975+ let name = if borrow_span. in_external_macro ( self . infcx . tcx . sess . source_map ( ) ) {
2976+ // Don't name local variables in external macros.
2977+ "value" . to_string ( )
2978+ } else {
2979+ format ! ( "`{name}`" )
2980+ } ;
2981+
2982+ let mut err = self . path_does_not_live_long_enough ( borrow_span, & name) ;
29762983
29772984 if let Some ( annotation) = self . annotate_argument_and_return_for_borrow ( borrow) {
29782985 let region_name = annotation. emit ( self , & mut err) ;
29792986
29802987 err. span_label (
29812988 borrow_span,
2982- format ! ( "` {name}` would have to be valid for `{region_name}`..." ) ,
2989+ format ! ( "{name} would have to be valid for `{region_name}`..." ) ,
29832990 ) ;
29842991
29852992 err. span_label (
29862993 drop_span,
29872994 format ! (
2988- "...but `{}` will be dropped here, when the {} returns" ,
2989- name,
2995+ "...but {name} will be dropped here, when the {} returns" ,
29902996 self . infcx
29912997 . tcx
29922998 . opt_item_name( self . mir_def_id( ) . to_def_id( ) )
@@ -3024,7 +3030,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
30243030 }
30253031 } else {
30263032 err. span_label ( borrow_span, "borrowed value does not live long enough" ) ;
3027- err. span_label ( drop_span, format ! ( "` {name}` dropped here while still borrowed" ) ) ;
3033+ err. span_label ( drop_span, format ! ( "{name} dropped here while still borrowed" ) ) ;
30283034
30293035 borrow_spans. args_subdiag ( & mut err, |args_span| {
30303036 crate :: session_diagnostics:: CaptureArgLabel :: Capture {
0 commit comments