about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-03-31 10:14:21 +0100
committerDavid Wood <david.wood@huawei.com>2022-04-05 07:01:02 +0100
commita52b5072ac9644ce4f8e336c9c1d79f7afe16f9f (patch)
treeaa00673038a250a4ee0d5e71fbcfc1d2234f2934
parent9956d4f99d021fa255d007dc17f23a3b0cd351e9 (diff)
downloadrust-a52b5072ac9644ce4f8e336c9c1d79f7afe16f9f.tar.gz
rust-a52b5072ac9644ce4f8e336c9c1d79f7afe16f9f.zip
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 <david.wood@huawei.com>
-rw-r--r--compiler/rustc_error_messages/src/lib.rs9
1 files changed, 9 insertions, 0 deletions
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<Lrc<FluentBundle>, 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)