File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,12 @@ impl Display for RegionName {
187187 }
188188}
189189
190+ impl rustc_errors:: IntoDiagnosticArg for RegionName {
191+ fn into_diagnostic_arg ( self ) -> rustc_errors:: DiagnosticArgValue < ' static > {
192+ self . to_string ( ) . into_diagnostic_arg ( )
193+ }
194+ }
195+
190196impl < ' tcx > MirBorrowckCtxt < ' _ , ' tcx > {
191197 pub ( crate ) fn mir_def_id ( & self ) -> hir:: def_id:: LocalDefId {
192198 self . body . source . def_id ( ) . expect_local ( )
Original file line number Diff line number Diff line change 1- use rustc_errors:: { IntoDiagnosticArg , MultiSpan } ;
1+ use rustc_errors:: MultiSpan ;
22use rustc_macros:: { LintDiagnostic , SessionDiagnostic , SessionSubdiagnostic } ;
33use rustc_middle:: ty:: Ty ;
44use rustc_span:: Span ;
@@ -137,18 +137,6 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> {
137137 } ,
138138}
139139
140- impl IntoDiagnosticArg for & RegionName {
141- fn into_diagnostic_arg ( self ) -> rustc_errors:: DiagnosticArgValue < ' static > {
142- format ! ( "{}" , self ) . into_diagnostic_arg ( )
143- }
144- }
145-
146- impl IntoDiagnosticArg for RegionName {
147- fn into_diagnostic_arg ( self ) -> rustc_errors:: DiagnosticArgValue < ' static > {
148- format ! ( "{}" , self ) . into_diagnostic_arg ( )
149- }
150- }
151-
152140#[ derive( SessionSubdiagnostic ) ]
153141pub ( crate ) enum RequireStaticErr {
154142 #[ note( borrowck:: used_impl_require_static) ]
Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ pub trait IntoDiagnosticArg {
4343 fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > ;
4444}
4545
46+ impl < ' a , T : Clone + IntoDiagnosticArg > IntoDiagnosticArg for & ' a T {
47+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
48+ self . clone ( ) . into_diagnostic_arg ( )
49+ }
50+ }
51+
4652pub struct DiagnosticArgFromDisplay < ' a > ( pub & ' a dyn fmt:: Display ) ;
4753
4854impl IntoDiagnosticArg for DiagnosticArgFromDisplay < ' _ > {
You can’t perform that action at this time.
0 commit comments