From a52b5072ac9644ce4f8e336c9c1d79f7afe16f9f Mon Sep 17 00:00:00 2001 From: David Wood Date: Thu, 31 Mar 2022 10:14:21 +0100 Subject: [PATCH] errors: disable directionality isolation markers Fluent diagnostics can insert directionality isolation markers around interpolated variables indicating that there may be a shift from right-to-left to left-to-right text (or vice-versa). These are disabled because they are sometimes visible in the error output, but may be worth investigating in future (for example: if type names are left-to-right and the surrounding diagnostic messages are right-to-left, then these might be helpful). Signed-off-by: David Wood --- compiler/rustc_error_messages/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index 15f0db49b07..c5fd43eda3c 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -111,6 +111,13 @@ pub fn fluent_bundle( trace!(?locale); let mut bundle = FluentBundle::new(vec![locale]); + // Fluent diagnostics can insert directionality isolation markers around interpolated variables + // indicating that there may be a shift from right-to-left to left-to-right text (or + // vice-versa). These are disabled because they are sometimes visible in the error output, but + // may be worth investigating in future (for example: if type names are left-to-right and the + // surrounding diagnostic messages are right-to-left, then these might be helpful). + bundle.set_use_isolating(false); + if let Some(requested_locale) = requested_locale { let mut sysroot = sysroot.to_path_buf(); sysroot.push("share"); @@ -161,6 +168,8 @@ pub fn fallback_fluent_bundle() -> Result, TranslationBundleEr .map_err(TranslationBundleError::from)?; trace!(?fallback_resource); let mut fallback_bundle = FluentBundle::new(vec![langid!("en-US")]); + // See comment in `fluent_bundle`. + fallback_bundle.set_use_isolating(false); fallback_bundle.add_resource(fallback_resource).map_err(TranslationBundleError::from)?; let fallback_bundle = Lrc::new(fallback_bundle); Ok(fallback_bundle)