about summary refs log tree commit diff
path: root/compiler/rustc_errors
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-10-17 11:36:54 +0100
committerDavid Wood <david.wood@huawei.com>2023-02-22 09:15:54 +0000
commita8e37507f4815c789a6fcb204f209806a4c3952d (patch)
tree87bc7cfd10418057ed067cfb80f6ba837fc0f353 /compiler/rustc_errors
parentd1fcf611175e695c35c6cc0537d710277c1a5c6f (diff)
downloadrust-a8e37507f4815c789a6fcb204f209806a4c3952d.tar.gz
rust-a8e37507f4815c789a6fcb204f209806a4c3952d.zip
errors: fix translation's run-make test
`run-make/translation` had some targets that weren't listed in `all` and
thus weren't being tested - the behaviour that should have been being
tested was basically correct fortunately.

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_errors')
-rw-r--r--compiler/rustc_errors/src/translation.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/translation.rs b/compiler/rustc_errors/src/translation.rs
index addfc9726ca..1ac9b8e03c7 100644
--- a/compiler/rustc_errors/src/translation.rs
+++ b/compiler/rustc_errors/src/translation.rs
@@ -4,6 +4,7 @@ use crate::{DiagnosticArg, DiagnosticMessage, FluentBundle};
 use rustc_data_structures::sync::Lrc;
 use rustc_error_messages::FluentArgs;
 use std::borrow::Cow;
+use std::env;
 use std::error::Report;
 
 /// Convert diagnostic arguments (a rustc internal type that exists to implement
@@ -94,8 +95,16 @@ pub trait Translate {
                 // The primary bundle was present and translation succeeded
                 Some(Ok(t)) => t,
 
-                // Always yeet out for errors on debug
-                Some(Err(primary)) if cfg!(debug_assertions) => do yeet primary,
+                // Always yeet out for errors on debug (unless
+                // `RUSTC_TRANSLATION_NO_DEBUG_ASSERT` is set in the environment - this allows
+                // local runs of the test suites, of builds with debug assertions, to test the
+                // behaviour in a normal build).
+                Some(Err(primary))
+                    if cfg!(debug_assertions)
+                        && env::var("RUSTC_TRANSLATION_NO_DEBUG_ASSERT").is_err() =>
+                {
+                    do yeet primary
+                }
 
                 // If `translate_with_bundle` returns `Err` with the primary bundle, this is likely
                 // just that the primary bundle doesn't contain the message being translated or