@@ -17,13 +17,13 @@ shown below:
17
17
18
18
``` rust,ignore
19
19
#[derive(Diagnostic)]
20
- #[diag(typeck ::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(typeck ::previous_decl_label)]
26
+ #[label(hir_analysis ::previous_decl_label)]
27
27
pub prev_span: Span,
28
28
}
29
29
```
@@ -47,13 +47,13 @@ In our example, the Fluent message for the "field already declared" diagnostic
47
47
looks like this:
48
48
49
49
``` fluent
50
- typeck_field_already_declared =
50
+ hir_analysis_field_already_declared =
51
51
field `{$field_name}` is already declared
52
52
.label = field already declared
53
53
.previous_decl_label = `{$field_name}` first declared here
54
54
```
55
55
56
- ` typeck_field_already_declared ` is the slug from our example and is followed
56
+ ` hir_analysis_field_already_declared ` is the slug from our example and is followed
57
57
by the diagnostic message.
58
58
59
59
Every field of the ` Diagnostic ` which does not have an annotation is
@@ -73,7 +73,7 @@ type `Span`. Applying any of these attributes will create the corresponding
73
73
subdiagnostic with that ` Span ` . These attributes will look for their
74
74
diagnostic message in a Fluent attribute attached to the primary Fluent
75
75
message. In our example, ` #[label] ` will look for
76
- ` typeck_field_already_declared .label` (which has the message "field already
76
+ ` hir_analysis_field_already_declared .label` (which has the message "field already
77
77
declared"). If there is more than one subdiagnostic of the same type, then
78
78
these attributes can also take a value that is the attribute name to look for
79
79
(e.g. ` previous_decl_label ` in our example).
@@ -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::typeck ::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::typeck ::label
120
+ rustc_errors::fluent::hir_analysis ::label
121
121
);
122
122
diag.span_label(
123
123
self.prev_span,
124
- rustc_errors::fluent::typeck ::previous_decl_label
124
+ rustc_errors::fluent::hir_analysis ::previous_decl_label
125
125
);
126
126
diag
127
127
}
@@ -154,9 +154,9 @@ following attributes:
154
154
- A path to an item in ` rustc_errors::fluent ` . Always in a module starting
155
155
with a Fluent resource name (which is typically the name of the crate
156
156
that the diagnostic is from), e.g.
157
- ` rustc_errors::fluent::typeck ::field_already_declared `
157
+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
158
158
(` rustc_errors::fluent ` is implicit in the attribute, so just
159
- ` typeck ::field_already_declared` ).
159
+ ` hir_analysis ::field_already_declared` ).
160
160
- See [ translation documentation] ( ./translation.md ) .
161
161
- ` code = "..." ` (_ Optional_ )
162
162
- Specifies the error code.
@@ -194,11 +194,11 @@ following attributes:
194
194
- A path to an item in ` rustc_errors::fluent ` . Always in a module starting
195
195
with a Fluent resource name (which is typically the name of the crate
196
196
that the diagnostic is from), e.g.
197
- ` rustc_errors::fluent::typeck ::field_already_declared `
197
+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
198
198
(` rustc_errors::fluent ` is implicit in the attribute, so just
199
- ` typeck ::field_already_declared` ). Fluent attributes for all messages
200
- exist as top-level items in that module (so ` typeck_message .attr` is just
201
- ` typeck ::attr` ).
199
+ ` hir_analysis ::field_already_declared` ). Fluent attributes for all messages
200
+ exist as top-level items in that module (so ` hir_analysis_message .attr` is just
201
+ ` hir_analysis ::attr` ).
202
202
- See [ translation documentation] ( ./translation.md ) .
203
203
- Defaults to ` rustc_errors::fluent::_subdiag::suggestion ` (or
204
204
- ` .suggestion ` in Fluent).
@@ -233,12 +233,12 @@ shown below:
233
233
``` rust
234
234
#[derive(Subdiagnostic )]
235
235
pub enum ExpectedReturnTypeLabel <'tcx > {
236
- #[label(typeck :: expected_default_return_type)]
236
+ #[label(hir_analysis :: expected_default_return_type)]
237
237
Unit {
238
238
#[primary_span]
239
239
span : Span ,
240
240
},
241
- #[label(typeck :: expected_return_type)]
241
+ #[label(hir_analysis :: expected_return_type)]
242
242
Other {
243
243
#[primary_span]
244
244
span : Span ,
@@ -268,9 +268,9 @@ In our example, the Fluent message for the "expected return type" label
268
268
looks like this:
269
269
270
270
``` fluent
271
- typeck_expected_default_return_type = expected `()` because of default return type
271
+ hir_analysis_expected_default_return_type = expected `()` because of default return type
272
272
273
- typeck_expected_return_type = expected `{$expected}` because of return type
273
+ hir_analysis_expected_return_type = expected `{$expected}` because of return type
274
274
```
275
275
276
276
Using the ` #[primary_span] ` attribute on a field (with type ` Span ` ) will denote
@@ -315,11 +315,11 @@ impl<'tcx> AddToDiagnostic for ExpectedReturnTypeLabel<'tcx> {
315
315
use rustc_errors :: {Applicability , IntoDiagnosticArg };
316
316
match self {
317
317
ExpectedReturnTypeLabel :: Unit { span } => {
318
- diag . span_label (span , rustc_errors :: fluent :: typeck :: expected_default_return_type )
318
+ diag . span_label (span , rustc_errors :: fluent :: hir_analysis :: expected_default_return_type )
319
319
}
320
320
ExpectedReturnTypeLabel :: Other { span , expected } => {
321
321
diag . set_arg (" expected" , expected );
322
- diag . span_label (span , rustc_errors :: fluent :: typeck :: expected_return_type )
322
+ diag . span_label (span , rustc_errors :: fluent :: hir_analysis :: expected_return_type )
323
323
}
324
324
325
325
}
@@ -345,9 +345,9 @@ diagnostic struct.
345
345
- A path to an item in ` rustc_errors::fluent ` . Always in a module starting
346
346
with a Fluent resource name (which is typically the name of the crate
347
347
that the diagnostic is from), e.g.
348
- ` rustc_errors::fluent::typeck ::field_already_declared `
348
+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
349
349
(` rustc_errors::fluent ` is implicit in the attribute, so just
350
- ` typeck ::field_already_declared` ).
350
+ ` hir_analysis ::field_already_declared` ).
351
351
- See [ translation documentation] ( ./translation.md ) .
352
352
- ` #[suggestion{,_hidden,_short,_verbose}(slug, code = "...", applicability = "...")] `
353
353
- _ Applied to struct or enum variant. Mutually exclusive with struct/enum variant attributes._
@@ -357,11 +357,11 @@ diagnostic struct.
357
357
- A path to an item in ` rustc_errors::fluent ` . Always in a module starting
358
358
with a Fluent resource name (which is typically the name of the crate
359
359
that the diagnostic is from), e.g.
360
- ` rustc_errors::fluent::typeck ::field_already_declared `
360
+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
361
361
(` rustc_errors::fluent ` is implicit in the attribute, so just
362
- ` typeck ::field_already_declared` ). Fluent attributes for all messages
363
- exist as top-level items in that module (so ` typeck_message .attr` is just
364
- ` typeck ::attr` ).
362
+ ` hir_analysis ::field_already_declared` ). Fluent attributes for all messages
363
+ exist as top-level items in that module (so ` hir_analysis_message .attr` is just
364
+ ` hir_analysis ::attr` ).
365
365
- See [ translation documentation] ( ./translation.md ) .
366
366
- Defaults to ` rustc_errors::fluent::_subdiag::suggestion ` (or
367
367
- ` .suggestion ` in Fluent).
@@ -399,9 +399,9 @@ to multipart suggestions)
399
399
- _ Applied to any field._
400
400
- Prevents the field from being provided as a diagnostic argument.
401
401
402
- [ defn ] : https://github.com/rust-lang/rust/blob/bbe9d27b8ff36da56638aa43d6d0cdfdf89a4e57 /compiler/rustc_typeck /src/errors.rs#L65-L74
403
- [ use ] : https://github.com/rust-lang/rust/blob/eb82facb1626166188d49599a3313fc95201f556 /compiler/rustc_typeck /src/collect.rs#L981-L985
402
+ [ defn ] : https://github.com/rust-lang/rust/blob/6201eabde85db854c1ebb57624be5ec699246b50 /compiler/rustc_hir_analysis /src/errors.rs#L68-L77
403
+ [ use ] : https://github.com/rust-lang/rust/blob/f1112099eba41abadb6f921df7edba70affe92c5 /compiler/rustc_hir_analysis /src/collect.rs#L823-L827
404
404
405
- [ subdiag_defn ] : https://github.com/rust-lang/rust/blob/e70c60d34b9783a2fd3171d88d248c2e0ec8ecdd /compiler/rustc_typeck /src/errors.rs#L220-L233
406
- [ subdiag_use_1 ] : https://github.com/rust-lang/rust/blob/e70c60d34b9783a2fd3171d88d248c2e0ec8ecdd /compiler/rustc_typeck /src/check/fn_ctxt/suggestions.rs#L556-L560
407
- [ subdiag_use_2 ] : https://github.com/rust-lang/rust/blob/e70c60d34b9783a2fd3171d88d248c2e0ec8ecdd /compiler/rustc_typeck /src/check/fn_ctxt/suggestions.rs#L575-L579
405
+ [ subdiag_defn ] : https://github.com/rust-lang/rust/blob/f1112099eba41abadb6f921df7edba70affe92c5 /compiler/rustc_hir_analysis /src/errors.rs#L221-L234
406
+ [ subdiag_use_1 ] : https://github.com/rust-lang/rust/blob/f1112099eba41abadb6f921df7edba70affe92c5 /compiler/rustc_hir_analysis /src/check/fn_ctxt/suggestions.rs#L670-L674
407
+ [ subdiag_use_2 ] : https://github.com/rust-lang/rust/blob/f1112099eba41abadb6f921df7edba70affe92c5 /compiler/rustc_hir_analysis /src/check/fn_ctxt/suggestions.rs#L704-L707
0 commit comments