diff options
| author | David Wood <david.wood@huawei.com> | 2022-04-06 04:16:07 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-04-12 10:15:37 +0100 |
| commit | fc3cca24f1230bb308e83168a3260abf36359f85 (patch) | |
| tree | 4312fa6d31df8a626db8fb8c046226261300bec9 /compiler/rustc_interface/src | |
| parent | 4e1927db3c399fa34dc71992bd5dbec09f945c3d (diff) | |
| download | rust-fc3cca24f1230bb308e83168a3260abf36359f85.tar.gz rust-fc3cca24f1230bb308e83168a3260abf36359f85.zip | |
sess: try sysroot candidates for fluent bundle
Instead of checking only the user provided sysroot or the default (when no sysroot is provided), search user provided sysroot and then check default sysroots for locale requested by the user. Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/tests.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/util.rs | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index a3570320767..fe75ee8b37b 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -44,6 +44,7 @@ fn mk_session(matches: getopts::Matches) -> (Session, CfgSpecs) { let sess = build_session( sessopts, None, + None, registry, DiagnosticOutput::Default, Default::default(), diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 592cf60e6c3..3fa8017dc93 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -83,9 +83,23 @@ pub fn create_session( // target_override is documented to be called before init(), so this is okay let target_override = codegen_backend.target_override(&sopts); + let bundle = match rustc_errors::fluent_bundle( + sopts.maybe_sysroot.clone(), + sysroot_candidates(), + sopts.debugging_opts.translate_lang.clone(), + sopts.debugging_opts.translate_additional_ftl.as_deref(), + sopts.debugging_opts.translate_directionality_markers, + ) { + Ok(bundle) => bundle, + Err(e) => { + early_error(sopts.error_format, &format!("failed to load fluent bundle: {e}")); + } + }; + let mut sess = session::build_session( sopts, input_path, + bundle, descriptions, diagnostic_output, lint_caps, |
