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 {
187
187
}
188
188
}
189
189
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
+
190
196
impl < ' tcx > MirBorrowckCtxt < ' _ , ' tcx > {
191
197
pub ( crate ) fn mir_def_id ( & self ) -> hir:: def_id:: LocalDefId {
192
198
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 ;
2
2
use rustc_macros:: { LintDiagnostic , SessionDiagnostic , SessionSubdiagnostic } ;
3
3
use rustc_middle:: ty:: Ty ;
4
4
use rustc_span:: Span ;
@@ -137,18 +137,6 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> {
137
137
} ,
138
138
}
139
139
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
-
152
140
#[ derive( SessionSubdiagnostic ) ]
153
141
pub ( crate ) enum RequireStaticErr {
154
142
#[ note( borrowck:: used_impl_require_static) ]
Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ pub trait IntoDiagnosticArg {
43
43
fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > ;
44
44
}
45
45
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
+
46
52
pub struct DiagnosticArgFromDisplay < ' a > ( pub & ' a dyn fmt:: Display ) ;
47
53
48
54
impl IntoDiagnosticArg for DiagnosticArgFromDisplay < ' _ > {
You can’t perform that action at this time.
0 commit comments