@@ -17,13 +17,13 @@ shown below:
17
17
18
18
``` rust,ignore
19
19
#[derive(Diagnostic)]
20
- #[diag(hir_analysis::field_already_declared , code = "E0124")]
20
+ #[diag(hir_analysis_field_already_declared , code = "E0124")]
21
21
pub struct FieldAlreadyDeclared {
22
22
pub field_name: Ident,
23
23
#[primary_span]
24
24
#[label]
25
25
pub span: Span,
26
- #[label(hir_analysis::previous_decl_label )]
26
+ #[label(hir_analysis_previous_decl_label )]
27
27
pub prev_span: Span,
28
28
}
29
29
```
@@ -113,15 +113,15 @@ In the end, the `Diagnostic` derive will generate an implementation of
113
113
``` rust,ignore
114
114
impl IntoDiagnostic<'_> for FieldAlreadyDeclared {
115
115
fn into_diagnostic(self, handler: &'_ rustc_errors::Handler) -> DiagnosticBuilder<'_> {
116
- let mut diag = handler.struct_err(rustc_errors::fluent::hir_analysis::field_already_declared );
116
+ let mut diag = handler.struct_err(rustc_errors::fluent::hir_analysis_field_already_declared );
117
117
diag.set_span(self.span);
118
118
diag.span_label(
119
119
self.span,
120
- rustc_errors::fluent::hir_analysis::label
120
+ rustc_errors::fluent::hir_analysis_label
121
121
);
122
122
diag.span_label(
123
123
self.prev_span,
124
- rustc_errors::fluent::hir_analysis::previous_decl_label
124
+ rustc_errors::fluent::hir_analysis_previous_decl_label
125
125
);
126
126
diag
127
127
}
@@ -151,12 +151,10 @@ following attributes:
151
151
- Slug (_ Mandatory_ )
152
152
- Uniquely identifies the diagnostic and corresponds to its Fluent message,
153
153
mandatory.
154
- - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
155
- with a Fluent resource name (which is typically the name of the crate
156
- that the diagnostic is from), e.g.
157
- ` rustc_errors::fluent::hir_analysis::field_already_declared `
154
+ - A path to an item in ` rustc_errors::fluent ` , e.g.
155
+ ` rustc_errors::fluent::hir_analysis_field_already_declared `
158
156
(` rustc_errors::fluent ` is implicit in the attribute, so just
159
- ` hir_analysis::field_already_declared ` ).
157
+ ` hir_analysis_field_already_declared ` ).
160
158
- See [ translation documentation] ( ./translation.md ) .
161
159
- ` code = "..." ` (_ Optional_ )
162
160
- Specifies the error code.
@@ -191,14 +189,12 @@ following attributes:
191
189
- _ Applied to ` (Span, MachineApplicability) ` or ` Span ` fields._
192
190
- Adds a suggestion subdiagnostic.
193
191
- Slug (_ Mandatory_ )
194
- - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
195
- with a Fluent resource name (which is typically the name of the crate
196
- that the diagnostic is from), e.g.
197
- ` rustc_errors::fluent::hir_analysis::field_already_declared `
192
+ - A path to an item in ` rustc_errors::fluent ` , e.g.
193
+ ` rustc_errors::fluent::hir_analysis_field_already_declared `
198
194
(` rustc_errors::fluent ` is implicit in the attribute, so just
199
- ` hir_analysis::field_already_declared ` ). Fluent attributes for all messages
195
+ ` hir_analysis_field_already_declared ` ). Fluent attributes for all messages
200
196
exist as top-level items in that module (so ` hir_analysis_message.attr ` is just
201
- ` hir_analysis:: attr` ).
197
+ ` attr ` ).
202
198
- See [ translation documentation] ( ./translation.md ) .
203
199
- Defaults to ` rustc_errors::fluent::_subdiag::suggestion ` (or
204
200
- ` .suggestion ` in Fluent).
@@ -233,12 +229,12 @@ shown below:
233
229
``` rust
234
230
#[derive(Subdiagnostic )]
235
231
pub enum ExpectedReturnTypeLabel <'tcx > {
236
- #[label(hir_analysis :: expected_default_return_type )]
232
+ #[label(hir_analysis_expected_default_return_type )]
237
233
Unit {
238
234
#[primary_span]
239
235
span : Span ,
240
236
},
241
- #[label(hir_analysis :: expected_return_type )]
237
+ #[label(hir_analysis_expected_return_type )]
242
238
Other {
243
239
#[primary_span]
244
240
span : Span ,
@@ -315,11 +311,11 @@ impl<'tcx> AddToDiagnostic for ExpectedReturnTypeLabel<'tcx> {
315
311
use rustc_errors :: {Applicability , IntoDiagnosticArg };
316
312
match self {
317
313
ExpectedReturnTypeLabel :: Unit { span } => {
318
- diag . span_label (span , rustc_errors :: fluent :: hir_analysis :: expected_default_return_type )
314
+ diag . span_label (span , rustc_errors :: fluent :: hir_analysis_expected_default_return_type )
319
315
}
320
316
ExpectedReturnTypeLabel :: Other { span , expected } => {
321
317
diag . set_arg (" expected" , expected );
322
- diag . span_label (span , rustc_errors :: fluent :: hir_analysis :: expected_return_type )
318
+ diag . span_label (span , rustc_errors :: fluent :: hir_analysis_expected_return_type )
323
319
}
324
320
325
321
}
@@ -342,22 +338,18 @@ diagnostic struct.
342
338
- Slug (_ Mandatory_ )
343
339
- Uniquely identifies the diagnostic and corresponds to its Fluent message,
344
340
mandatory.
345
- - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
346
- with a Fluent resource name (which is typically the name of the crate
347
- that the diagnostic is from), e.g.
348
- ` rustc_errors::fluent::hir_analysis::field_already_declared `
341
+ - A path to an item in ` rustc_errors::fluent ` , e.g.
342
+ ` rustc_errors::fluent::hir_analysis_field_already_declared `
349
343
(` rustc_errors::fluent ` is implicit in the attribute, so just
350
- ` hir_analysis::field_already_declared ` ).
344
+ ` hir_analysis_field_already_declared ` ).
351
345
- See [ translation documentation] ( ./translation.md ) .
352
346
- ` #[suggestion{,_hidden,_short,_verbose}(slug, code = "...", applicability = "...")] `
353
347
- _ Applied to struct or enum variant. Mutually exclusive with struct/enum variant attributes._
354
348
- _ Mandatory_
355
349
- Defines the type to be representing a suggestion.
356
350
- Slug (_ Mandatory_ )
357
- - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
358
- with a Fluent resource name (which is typically the name of the crate
359
- that the diagnostic is from), e.g.
360
- ` rustc_errors::fluent::hir_analysis::field_already_declared `
351
+ - A path to an item in ` rustc_errors::fluent ` , e.g.
352
+ ` rustc_errors::fluent::hir_analysis_field_already_declared `
361
353
(` rustc_errors::fluent ` is implicit in the attribute, so just
362
354
` hir_analysis::field_already_declared ` ). Fluent attributes for all messages
363
355
exist as top-level items in that module (so ` hir_analysis_message.attr ` is just
0 commit comments