@@ -17,13 +17,13 @@ shown below:
1717
1818``` rust,ignore
1919#[derive(Diagnostic)]
20- #[diag(typeck ::field_already_declared, code = "E0124")]
20+ #[diag(hir_analysis ::field_already_declared, code = "E0124")]
2121pub struct FieldAlreadyDeclared {
2222 pub field_name: Ident,
2323 #[primary_span]
2424 #[label]
2525 pub span: Span,
26- #[label(typeck ::previous_decl_label)]
26+ #[label(hir_analysis ::previous_decl_label)]
2727 pub prev_span: Span,
2828}
2929```
@@ -47,13 +47,13 @@ In our example, the Fluent message for the "field already declared" diagnostic
4747looks like this:
4848
4949``` fluent
50- typeck_field_already_declared =
50+ hir_analysis_field_already_declared =
5151 field `{$field_name}` is already declared
5252 .label = field already declared
5353 .previous_decl_label = `{$field_name}` first declared here
5454```
5555
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
5757by the diagnostic message.
5858
5959Every 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
7373subdiagnostic with that ` Span ` . These attributes will look for their
7474diagnostic message in a Fluent attribute attached to the primary Fluent
7575message. 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
7777declared"). If there is more than one subdiagnostic of the same type, then
7878these attributes can also take a value that is the attribute name to look for
7979(e.g. ` previous_decl_label ` in our example).
@@ -113,15 +113,15 @@ In the end, the `Diagnostic` derive will generate an implementation of
113113``` rust,ignore
114114impl IntoDiagnostic<'_> for FieldAlreadyDeclared {
115115 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);
117117 diag.set_span(self.span);
118118 diag.span_label(
119119 self.span,
120- rustc_errors::fluent::typeck ::label
120+ rustc_errors::fluent::hir_analysis ::label
121121 );
122122 diag.span_label(
123123 self.prev_span,
124- rustc_errors::fluent::typeck ::previous_decl_label
124+ rustc_errors::fluent::hir_analysis ::previous_decl_label
125125 );
126126 diag
127127 }
@@ -154,9 +154,9 @@ following attributes:
154154 - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
155155 with a Fluent resource name (which is typically the name of the crate
156156 that the diagnostic is from), e.g.
157- ` rustc_errors::fluent::typeck ::field_already_declared `
157+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
158158 (` rustc_errors::fluent ` is implicit in the attribute, so just
159- ` typeck ::field_already_declared` ).
159+ ` hir_analysis ::field_already_declared` ).
160160 - See [ translation documentation] ( ./translation.md ) .
161161 - ` code = "..." ` (_ Optional_ )
162162 - Specifies the error code.
@@ -194,11 +194,11 @@ following attributes:
194194 - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
195195 with a Fluent resource name (which is typically the name of the crate
196196 that the diagnostic is from), e.g.
197- ` rustc_errors::fluent::typeck ::field_already_declared `
197+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
198198 (` 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` ).
202202 - See [ translation documentation] ( ./translation.md ) .
203203 - Defaults to ` rustc_errors::fluent::_subdiag::suggestion ` (or
204204 - ` .suggestion ` in Fluent).
@@ -233,12 +233,12 @@ shown below:
233233``` rust
234234#[derive(Subdiagnostic )]
235235pub enum ExpectedReturnTypeLabel <'tcx > {
236- #[label(typeck :: expected_default_return_type)]
236+ #[label(hir_analysis :: expected_default_return_type)]
237237 Unit {
238238 #[primary_span]
239239 span : Span ,
240240 },
241- #[label(typeck :: expected_return_type)]
241+ #[label(hir_analysis :: expected_return_type)]
242242 Other {
243243 #[primary_span]
244244 span : Span ,
@@ -268,9 +268,9 @@ In our example, the Fluent message for the "expected return type" label
268268looks like this:
269269
270270``` 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
272272
273- typeck_expected_return_type = expected `{$expected}` because of return type
273+ hir_analysis_expected_return_type = expected `{$expected}` because of return type
274274```
275275
276276Using the ` #[primary_span] ` attribute on a field (with type ` Span ` ) will denote
@@ -315,11 +315,11 @@ impl<'tcx> AddToDiagnostic for ExpectedReturnTypeLabel<'tcx> {
315315 use rustc_errors :: {Applicability , IntoDiagnosticArg };
316316 match self {
317317 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 )
319319 }
320320 ExpectedReturnTypeLabel :: Other { span , expected } => {
321321 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 )
323323 }
324324
325325 }
@@ -345,9 +345,9 @@ diagnostic struct.
345345 - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
346346 with a Fluent resource name (which is typically the name of the crate
347347 that the diagnostic is from), e.g.
348- ` rustc_errors::fluent::typeck ::field_already_declared `
348+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
349349 (` rustc_errors::fluent ` is implicit in the attribute, so just
350- ` typeck ::field_already_declared` ).
350+ ` hir_analysis ::field_already_declared` ).
351351 - See [ translation documentation] ( ./translation.md ) .
352352- ` #[suggestion{,_hidden,_short,_verbose}(slug, code = "...", applicability = "...")] `
353353 - _ Applied to struct or enum variant. Mutually exclusive with struct/enum variant attributes._
@@ -357,11 +357,11 @@ diagnostic struct.
357357 - A path to an item in ` rustc_errors::fluent ` . Always in a module starting
358358 with a Fluent resource name (which is typically the name of the crate
359359 that the diagnostic is from), e.g.
360- ` rustc_errors::fluent::typeck ::field_already_declared `
360+ ` rustc_errors::fluent::hir_analysis ::field_already_declared `
361361 (` 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` ).
365365 - See [ translation documentation] ( ./translation.md ) .
366366 - Defaults to ` rustc_errors::fluent::_subdiag::suggestion ` (or
367367 - ` .suggestion ` in Fluent).
@@ -399,9 +399,9 @@ to multipart suggestions)
399399 - _ Applied to any field._
400400 - Prevents the field from being provided as a diagnostic argument.
401401
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
404404
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