Skip to content

Commit 34d6f08

Browse files
Use dashes instead of underscores in fluent names
1 parent 9b21131 commit 34d6f08

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
builtin_macros-requires-cfg-pattern =
1+
builtin-macros-requires-cfg-pattern =
22
macro requires a cfg-pattern as an argument
33
.label = cfg-pattern required
44
5-
builtin_macros-expected-one-cfg-pattern = expected 1 cfg-pattern
5+
builtin-macros-expected-one-cfg-pattern = expected 1 cfg-pattern

compiler/rustc_macros/src/diagnostics/fluent.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,13 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
189189
if let Entry::Message(Message { id: Identifier { name }, attributes, .. }) = entry {
190190
let _ = previous_defns.entry(name.to_string()).or_insert(ident_span);
191191

192-
// `typeck-foo-bar` => `foo_bar`
192+
// `typeck-foo-bar` => `foo_bar` (in `typeck.ftl`)
193+
// `const-eval-baz` => `baz` (in `const_eval.ftl`)
193194
let snake_name = Ident::new(
194-
&name.replace(&format!("{}-", res.ident), "").replace("-", "_"),
195+
// FIXME: should probably trim prefix, not replace all occurrences
196+
&name
197+
.replace(&format!("{}-", res.ident).replace("_", "-"), "")
198+
.replace("-", "_"),
195199
span,
196200
);
197201
constants.extend(quote! {

0 commit comments

Comments
 (0)