diff options
| author | David Wood <david.wood@huawei.com> | 2022-04-03 04:53:01 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-04-05 07:01:03 +0100 |
| commit | 3c2f864ffbf0e3d01f3f684acbd0ee602619bf19 (patch) | |
| tree | 9a4bd3d308bf6a718e86e31784f1eddb738b8693 /compiler/rustc_session/src | |
| parent | e27389b068a3b71c87cf81828d1d878d24a3b867 (diff) | |
| download | rust-3c2f864ffbf0e3d01f3f684acbd0ee602619bf19.tar.gz rust-3c2f864ffbf0e3d01f3f684acbd0ee602619bf19.zip | |
session: opt for enabling directionality markers
Add an option for enabling and disabling Fluent's directionality isolation markers in output. Disabled by default as these can render in some terminals and applications. Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_session/src/parse.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 8 |
3 files changed, 10 insertions, 4 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 7303d701ae1..4994f8eaeb2 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1482,6 +1482,8 @@ options! { "language identifier for diagnostic output"), translate_additional_ftl: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], "additional fluent translation to preferentially use (for testing translation)"), + translate_directionality_markers: bool = (false, parse_bool, [TRACKED], + "emit directionality isolation markers in translated diagnostics"), tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED], "select processor to schedule for (`rustc --print target-cpus` for details)"), thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED], diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 6b99e011c45..0b9c27c2cd6 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -175,7 +175,7 @@ impl ParseSess { /// Used for testing. pub fn new(file_path_mapping: FilePathMapping) -> Self { let fallback_bundle = - fallback_fluent_bundle().expect("failed to load fallback fluent bundle"); + fallback_fluent_bundle(false).expect("failed to load fallback fluent bundle"); let sm = Lrc::new(SourceMap::new(file_path_mapping)); let handler = Handler::with_tty_emitter( ColorConfig::Auto, @@ -214,7 +214,7 @@ impl ParseSess { pub fn with_silent_emitter(fatal_note: Option<String>) -> Self { let fallback_bundle = - fallback_fluent_bundle().expect("failed to load fallback fluent bundle"); + fallback_fluent_bundle(false).expect("failed to load fallback fluent bundle"); let sm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let fatal_handler = Handler::with_tty_emitter(ColorConfig::Auto, false, None, None, None, fallback_bundle); diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 74c0f67e633..9881046ddfa 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1218,9 +1218,12 @@ pub fn build_session( &sysroot, sopts.debugging_opts.translate_lang.clone(), sopts.debugging_opts.translate_additional_ftl.as_deref(), + sopts.debugging_opts.translate_directionality_markers, ) .expect("failed to load fluent bundle"); - let fallback_bundle = fallback_fluent_bundle().expect("failed to load fallback fluent bundle"); + let fallback_bundle = + fallback_fluent_bundle(sopts.debugging_opts.translate_directionality_markers) + .expect("failed to load fallback fluent bundle"); let emitter = default_emitter(&sopts, registry, source_map.clone(), bundle, fallback_bundle, write_dest); @@ -1455,7 +1458,8 @@ pub enum IncrCompSession { } fn early_error_handler(output: config::ErrorOutputType) -> rustc_errors::Handler { - let fallback_bundle = fallback_fluent_bundle().expect("failed to load fallback fluent bundle"); + let fallback_bundle = + fallback_fluent_bundle(false).expect("failed to load fallback fluent bundle"); let emitter: Box<dyn Emitter + sync::Send> = match output { config::ErrorOutputType::HumanReadable(kind) => { let (short, color_config) = kind.unzip(); |
