@@ -34,13 +34,13 @@ pub(crate) enum RegionNameSource {
3434 /// The `'static` region.
3535 Static ,
3636 /// The free region corresponding to the environment of a closure.
37- SynthesizedFreeEnvRegion ( Span , String ) ,
37+ SynthesizedFreeEnvRegion ( Span , & ' static str ) ,
3838 /// The region corresponding to an argument.
3939 AnonRegionFromArgument ( RegionNameHighlight ) ,
4040 /// The region corresponding to a closure upvar.
41- AnonRegionFromUpvar ( Span , String ) ,
41+ AnonRegionFromUpvar ( Span , Symbol ) ,
4242 /// The region corresponding to the return type of a closure.
43- AnonRegionFromOutput ( RegionNameHighlight , String ) ,
43+ AnonRegionFromOutput ( RegionNameHighlight , & ' static str ) ,
4444 /// The region from a type yielded by a generator.
4545 AnonRegionFromYieldTy ( Span , String ) ,
4646 /// An anonymous region from an async fn.
@@ -110,7 +110,7 @@ impl RegionName {
110110 }
111111 RegionNameSource :: SynthesizedFreeEnvRegion ( span, note) => {
112112 diag. span_label ( * span, format ! ( "lifetime `{self}` represents this closure's body" ) ) ;
113- diag. note ( note) ;
113+ diag. note ( * note) ;
114114 }
115115 RegionNameSource :: AnonRegionFromArgument ( RegionNameHighlight :: CannotMatchHirTy (
116116 span,
@@ -350,10 +350,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
350350
351351 Some ( RegionName {
352352 name : region_name,
353- source : RegionNameSource :: SynthesizedFreeEnvRegion (
354- fn_decl_span,
355- note. to_string ( ) ,
356- ) ,
353+ source : RegionNameSource :: SynthesizedFreeEnvRegion ( fn_decl_span, note) ,
357354 } )
358355 }
359356
@@ -678,7 +675,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
678675
679676 Some ( RegionName {
680677 name : region_name,
681- source : RegionNameSource :: AnonRegionFromUpvar ( upvar_span, upvar_name. to_string ( ) ) ,
678+ source : RegionNameSource :: AnonRegionFromUpvar ( upvar_span, upvar_name) ,
682679 } )
683680 }
684681
@@ -756,7 +753,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
756753
757754 Some ( RegionName {
758755 name : self . synthesize_region_name ( ) ,
759- source : RegionNameSource :: AnonRegionFromOutput ( highlight, mir_description. to_string ( ) ) ,
756+ source : RegionNameSource :: AnonRegionFromOutput ( highlight, mir_description) ,
760757 } )
761758 }
762759
0 commit comments