about summary refs log tree commit diff
path: root/compiler/rustc_fluent_macro
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2023-05-06 00:29:52 +0100
committerclubby789 <jamie@hill-daniel.co.uk>2023-05-26 10:44:18 +0000
commit220bb61b3317340d01d95aad4f4d30cca91943f2 (patch)
tree60d1f45ef2ea552546afc0eb23799a997623c467 /compiler/rustc_fluent_macro
parent9b5574f028c75d794b51c96ff6471ddf756f329b (diff)
downloadrust-220bb61b3317340d01d95aad4f4d30cca91943f2.tar.gz
rust-220bb61b3317340d01d95aad4f4d30cca91943f2.zip
Fix diagnostics with errors
Diffstat (limited to 'compiler/rustc_fluent_macro')
-rw-r--r--compiler/rustc_fluent_macro/src/fluent.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/compiler/rustc_fluent_macro/src/fluent.rs b/compiler/rustc_fluent_macro/src/fluent.rs
index b1c83e0dedc..56e23ac2775 100644
--- a/compiler/rustc_fluent_macro/src/fluent.rs
+++ b/compiler/rustc_fluent_macro/src/fluent.rs
@@ -271,17 +271,15 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
                         );
                 });
             }
-            #[cfg(debug_assertions)]
-            {
-                // Record variables referenced by these messages so we can produce
-                // tests in the derive diagnostics to validate them.
-                let ident = quote::format_ident!("{snake_name}_refs");
-                let vrefs = variable_references(msg);
-                constants.extend(quote! {
-                    #[cfg(test)]
-                    pub const #ident: &[&str] = &[#(#vrefs),*];
-                })
-            }
+
+            // Record variables referenced by these messages so we can produce
+            // tests in the derive diagnostics to validate them.
+            let ident = quote::format_ident!("{snake_name}_refs");
+            let vrefs = variable_references(msg);
+            constants.extend(quote! {
+                #[cfg(test)]
+                pub const #ident: &[&str] = &[#(#vrefs),*];
+            })
         }
     }
 
@@ -348,7 +346,6 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok
     .into()
 }
 
-#[cfg(debug_assertions)]
 fn variable_references<'a>(msg: &Message<&'a str>) -> Vec<&'a str> {
     let mut refs = vec![];
     if let Some(Pattern { elements }) = &msg.value {