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>
This commit is contained in:
David Wood 2022-10-17 11:36:54 +01:00
parent d1fcf61117
commit a8e37507f4
2 changed files with 22 additions and 9 deletions

View file

@ -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