@@ -23,7 +23,7 @@ use std::process::ExitStatus;
23
23
pub struct DiagnosticArgFromDisplay < ' a > ( pub & ' a dyn fmt:: Display ) ;
24
24
25
25
impl IntoDiagnosticArg for DiagnosticArgFromDisplay < ' _ > {
26
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
26
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
27
27
self . 0 . to_string ( ) . into_diagnostic_arg ( )
28
28
}
29
29
}
@@ -41,7 +41,7 @@ impl<'a, T: fmt::Display> From<&'a T> for DiagnosticArgFromDisplay<'a> {
41
41
}
42
42
43
43
impl < ' a , T : Clone + IntoDiagnosticArg > IntoDiagnosticArg for & ' a T {
44
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
44
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
45
45
self . clone ( ) . into_diagnostic_arg ( )
46
46
}
47
47
}
@@ -50,7 +50,7 @@ macro_rules! into_diagnostic_arg_using_display {
50
50
( $( $ty: ty ) ,+ $( , ) ?) => {
51
51
$(
52
52
impl IntoDiagnosticArg for $ty {
53
- fn into_diagnostic_arg( self ) -> DiagnosticArgValue < ' static > {
53
+ fn into_diagnostic_arg( self ) -> DiagnosticArgValue {
54
54
self . to_string( ) . into_diagnostic_arg( )
55
55
}
56
56
}
@@ -62,7 +62,7 @@ macro_rules! into_diagnostic_arg_for_number {
62
62
( $( $ty: ty ) ,+ $( , ) ?) => {
63
63
$(
64
64
impl IntoDiagnosticArg for $ty {
65
- fn into_diagnostic_arg( self ) -> DiagnosticArgValue < ' static > {
65
+ fn into_diagnostic_arg( self ) -> DiagnosticArgValue {
66
66
// HACK: `FluentNumber` the underline backing struct represent
67
67
// numbers using a f64 which can't represent all the i128 numbers
68
68
// So in order to be able to use fluent selectors and still
@@ -99,7 +99,7 @@ into_diagnostic_arg_using_display!(
99
99
into_diagnostic_arg_for_number ! ( i8 , u8 , i16 , u16 , i32 , u32 , i64 , u64 , i128 , u128 , isize , usize ) ;
100
100
101
101
impl IntoDiagnosticArg for bool {
102
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
102
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
103
103
if self {
104
104
DiagnosticArgValue :: Str ( Cow :: Borrowed ( "true" ) )
105
105
} else {
@@ -109,63 +109,63 @@ impl IntoDiagnosticArg for bool {
109
109
}
110
110
111
111
impl IntoDiagnosticArg for char {
112
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
112
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
113
113
DiagnosticArgValue :: Str ( Cow :: Owned ( format ! ( "{self:?}" ) ) )
114
114
}
115
115
}
116
116
117
117
impl IntoDiagnosticArg for Vec < char > {
118
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
118
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
119
119
DiagnosticArgValue :: StrListSepByAnd (
120
120
self . into_iter ( ) . map ( |c| Cow :: Owned ( format ! ( "{c:?}" ) ) ) . collect ( ) ,
121
121
)
122
122
}
123
123
}
124
124
125
125
impl IntoDiagnosticArg for Symbol {
126
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
126
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
127
127
self . to_ident_string ( ) . into_diagnostic_arg ( )
128
128
}
129
129
}
130
130
131
131
impl < ' a > IntoDiagnosticArg for & ' a str {
132
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
132
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
133
133
self . to_string ( ) . into_diagnostic_arg ( )
134
134
}
135
135
}
136
136
137
137
impl IntoDiagnosticArg for String {
138
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
138
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
139
139
DiagnosticArgValue :: Str ( Cow :: Owned ( self ) )
140
140
}
141
141
}
142
142
143
143
impl < ' a > IntoDiagnosticArg for Cow < ' a , str > {
144
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
144
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
145
145
DiagnosticArgValue :: Str ( Cow :: Owned ( self . into_owned ( ) ) )
146
146
}
147
147
}
148
148
149
149
impl < ' a > IntoDiagnosticArg for & ' a Path {
150
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
150
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
151
151
DiagnosticArgValue :: Str ( Cow :: Owned ( self . display ( ) . to_string ( ) ) )
152
152
}
153
153
}
154
154
155
155
impl IntoDiagnosticArg for PathBuf {
156
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
156
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
157
157
DiagnosticArgValue :: Str ( Cow :: Owned ( self . display ( ) . to_string ( ) ) )
158
158
}
159
159
}
160
160
161
161
impl IntoDiagnosticArg for PanicStrategy {
162
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
162
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
163
163
DiagnosticArgValue :: Str ( Cow :: Owned ( self . desc ( ) . to_string ( ) ) )
164
164
}
165
165
}
166
166
167
167
impl IntoDiagnosticArg for hir:: ConstContext {
168
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
168
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
169
169
DiagnosticArgValue :: Str ( Cow :: Borrowed ( match self {
170
170
hir:: ConstContext :: ConstFn => "const_fn" ,
171
171
hir:: ConstContext :: Static ( _) => "static" ,
@@ -175,57 +175,57 @@ impl IntoDiagnosticArg for hir::ConstContext {
175
175
}
176
176
177
177
impl IntoDiagnosticArg for ast:: Expr {
178
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
178
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
179
179
DiagnosticArgValue :: Str ( Cow :: Owned ( pprust:: expr_to_string ( & self ) ) )
180
180
}
181
181
}
182
182
183
183
impl IntoDiagnosticArg for ast:: Path {
184
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
184
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
185
185
DiagnosticArgValue :: Str ( Cow :: Owned ( pprust:: path_to_string ( & self ) ) )
186
186
}
187
187
}
188
188
189
189
impl IntoDiagnosticArg for ast:: token:: Token {
190
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
190
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
191
191
DiagnosticArgValue :: Str ( pprust:: token_to_string ( & self ) )
192
192
}
193
193
}
194
194
195
195
impl IntoDiagnosticArg for ast:: token:: TokenKind {
196
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
196
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
197
197
DiagnosticArgValue :: Str ( pprust:: token_kind_to_string ( & self ) )
198
198
}
199
199
}
200
200
201
201
impl IntoDiagnosticArg for type_ir:: FloatTy {
202
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
202
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
203
203
DiagnosticArgValue :: Str ( Cow :: Borrowed ( self . name_str ( ) ) )
204
204
}
205
205
}
206
206
207
207
impl IntoDiagnosticArg for std:: ffi:: CString {
208
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
208
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
209
209
DiagnosticArgValue :: Str ( Cow :: Owned ( self . to_string_lossy ( ) . into_owned ( ) ) )
210
210
}
211
211
}
212
212
213
213
impl IntoDiagnosticArg for rustc_data_structures:: small_c_str:: SmallCStr {
214
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
214
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
215
215
DiagnosticArgValue :: Str ( Cow :: Owned ( self . to_string_lossy ( ) . into_owned ( ) ) )
216
216
}
217
217
}
218
218
219
219
impl IntoDiagnosticArg for ast:: Visibility {
220
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
220
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
221
221
let s = pprust:: vis_to_string ( & self ) ;
222
222
let s = s. trim_end ( ) . to_string ( ) ;
223
223
DiagnosticArgValue :: Str ( Cow :: Owned ( s) )
224
224
}
225
225
}
226
226
227
227
impl IntoDiagnosticArg for rustc_lint_defs:: Level {
228
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
228
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
229
229
DiagnosticArgValue :: Str ( Cow :: Borrowed ( self . to_cmd_flag ( ) ) )
230
230
}
231
231
}
@@ -240,15 +240,15 @@ impl From<Vec<Symbol>> for DiagnosticSymbolList {
240
240
}
241
241
242
242
impl IntoDiagnosticArg for DiagnosticSymbolList {
243
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
243
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
244
244
DiagnosticArgValue :: StrListSepByAnd (
245
245
self . 0 . into_iter ( ) . map ( |sym| Cow :: Owned ( format ! ( "`{sym}`" ) ) ) . collect ( ) ,
246
246
)
247
247
}
248
248
}
249
249
250
250
impl < Id > IntoDiagnosticArg for hir:: def:: Res < Id > {
251
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
251
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
252
252
DiagnosticArgValue :: Str ( Cow :: Borrowed ( self . descr ( ) ) )
253
253
}
254
254
}
@@ -334,13 +334,13 @@ pub struct DelayedAtWithoutNewline {
334
334
}
335
335
336
336
impl IntoDiagnosticArg for DiagnosticLocation {
337
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
337
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
338
338
DiagnosticArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
339
339
}
340
340
}
341
341
342
342
impl IntoDiagnosticArg for Backtrace {
343
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
343
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
344
344
DiagnosticArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
345
345
}
346
346
}
@@ -353,7 +353,7 @@ pub struct InvalidFlushedDelayedDiagnosticLevel {
353
353
pub level : Level ,
354
354
}
355
355
impl IntoDiagnosticArg for Level {
356
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
356
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
357
357
DiagnosticArgValue :: Str ( Cow :: from ( self . to_string ( ) ) )
358
358
}
359
359
}
@@ -368,7 +368,7 @@ pub struct IndicateAnonymousLifetime {
368
368
}
369
369
370
370
impl IntoDiagnosticArg for type_ir:: ClosureKind {
371
- fn into_diagnostic_arg ( self ) -> DiagnosticArgValue < ' static > {
371
+ fn into_diagnostic_arg ( self ) -> DiagnosticArgValue {
372
372
DiagnosticArgValue :: Str ( self . as_str ( ) . into ( ) )
373
373
}
374
374
}
0 commit comments