diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2024-04-09 20:43:46 +0000 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2024-04-22 16:29:54 +0000 |
| commit | 3289a9a60dfbccce41e4db989708f5807a24cbdb (patch) | |
| tree | c6cea80879272e2a44d7360b80da27f16e38da83 | |
| parent | bfacfe25103f5f453ad8ab6a4f470dc7b94e59c3 (diff) | |
| download | rust-3289a9a60dfbccce41e4db989708f5807a24cbdb.tar.gz rust-3289a9a60dfbccce41e4db989708f5807a24cbdb.zip | |
rustc_expand: make diagnostic translatable
| -rw-r--r-- | compiler/rustc_expand/messages.ftl | 5 | ||||
| -rw-r--r-- | compiler/rustc_expand/src/config.rs | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl index fdd1a87cae8..c90673784e2 100644 --- a/compiler/rustc_expand/messages.ftl +++ b/compiler/rustc_expand/messages.ftl @@ -10,6 +10,11 @@ expand_attribute_meta_item = expand_attribute_single_word = attribute must only be a single word +expand_attributes_on_expressions_experimental = + attributes on expressions are experimental + .help_outer_doc = `///` is used for outer documentation comments; for a plain comment, use `//` + .help_inner_doc = `//!` is used for inner documentation comments; for a plain comment, use `//` by removing the `!` or inserting a space in between them: `// !` + expand_attributes_wrong_form = attribute must be of form: `attributes(foo, bar)` diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index 576607d576a..195e68f0cd6 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -373,7 +373,6 @@ impl<'a> StripUnconfigured<'a> { } /// If attributes are not allowed on expressions, emit an error for `attr` - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable #[instrument(level = "trace", skip(self))] pub(crate) fn maybe_emit_expr_attr_err(&self, attr: &Attribute) { if self.features.is_some_and(|features| !features.stmt_expr_attributes) @@ -383,14 +382,14 @@ impl<'a> StripUnconfigured<'a> { &self.sess, sym::stmt_expr_attributes, attr.span, - "attributes on expressions are experimental", + crate::fluent_generated::expand_attributes_on_expressions_experimental, ); if attr.is_doc_comment() { err.help(if attr.style == AttrStyle::Outer { - "`///` is used for outer documentation comments; for a plain comment, use `//`" + crate::fluent_generated::expand_help_outer_doc } else { - "`//!` is used for inner documentation comments; for a plain comment, use `//` by removing the `!` or inserting a space in between them: `// !`" + crate::fluent_generated::expand_help_inner_doc }); } |
