about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/diagnostics/fluent.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-06-28 21:03:14 -0700
committerMichael Goulet <michael@errs.io>2022-07-08 03:37:36 +0000
commit34d6f08f4d320efbefbe121319eed3928874e039 (patch)
tree7af058a962a04b7da062a92f375de2af142697f0 /compiler/rustc_macros/src/diagnostics/fluent.rs
parent9b21131278cc38ab8d79444de340015faadd061c (diff)
downloadrust-34d6f08f4d320efbefbe121319eed3928874e039.tar.gz
rust-34d6f08f4d320efbefbe121319eed3928874e039.zip
Use dashes instead of underscores in fluent names
Diffstat (limited to 'compiler/rustc_macros/src/diagnostics/fluent.rs')
-rw-r--r--compiler/rustc_macros/src/diagnostics/fluent.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/fluent.rs b/compiler/rustc_macros/src/diagnostics/fluent.rs
index 2317186e655..2758fcd1310 100644
--- a/compiler/rustc_macros/src/diagnostics/fluent.rs
+++ b/compiler/rustc_macros/src/diagnostics/fluent.rs
@@ -189,9 +189,13 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
             if let Entry::Message(Message { id: Identifier { name }, attributes, .. }) = entry {
                 let _ = previous_defns.entry(name.to_string()).or_insert(ident_span);
 
-                // `typeck-foo-bar` => `foo_bar`
+                // `typeck-foo-bar` => `foo_bar` (in `typeck.ftl`)
+                // `const-eval-baz` => `baz` (in `const_eval.ftl`)
                 let snake_name = Ident::new(
-                    &name.replace(&format!("{}-", res.ident), "").replace("-", "_"),
+                    // FIXME: should probably trim prefix, not replace all occurrences
+                    &name
+                        .replace(&format!("{}-", res.ident).replace("_", "-"), "")
+                        .replace("-", "_"),
                     span,
                 );
                 constants.extend(quote! {