diff options
| author | David Wood <david.wood@huawei.com> | 2022-03-28 09:36:20 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-04-05 07:01:02 +0100 |
| commit | d5119c5b9f1f71090d078e945ea6b5d39d08cffa (patch) | |
| tree | d63f8049bf2692b7fe2d34bf9e86ec7c26af6fe3 /compiler/rustc_errors/src/lib.rs | |
| parent | 7f91697b5035f8620df4de47057024c3539b55a6 (diff) | |
| download | rust-d5119c5b9f1f71090d078e945ea6b5d39d08cffa.tar.gz rust-d5119c5b9f1f71090d078e945ea6b5d39d08cffa.zip | |
errors: implement sysroot/testing bundle loading
Extend loading of Fluent bundles so that bundles can be loaded from the sysroot based on the language requested by the user, or using a nightly flag. Sysroot bundles are loaded from `$sysroot/share/locale/$locale/*.ftl`. Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_errors/src/lib.rs')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 04a0a9f7b73..5db6614c141 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -32,7 +32,8 @@ use rustc_data_structures::stable_hasher::StableHasher; use rustc_data_structures::sync::{self, Lock, Lrc}; use rustc_data_structures::AtomicRef; pub use rustc_error_messages::{ - fallback_fluent_bundle, DiagnosticMessage, FluentBundle, MultiSpan, SpanLabel, + fallback_fluent_bundle, fluent_bundle, DiagnosticMessage, FluentBundle, LanguageIdentifier, + MultiSpan, SpanLabel, }; pub use rustc_lint_defs::{pluralize, Applicability}; use rustc_serialize::json::Json; @@ -544,11 +545,13 @@ impl Handler { can_emit_warnings: bool, treat_err_as_bug: Option<NonZeroUsize>, sm: Option<Lrc<SourceMap>>, + fluent_bundle: Option<Lrc<FluentBundle>>, fallback_bundle: Lrc<FluentBundle>, ) -> Self { Self::with_tty_emitter_and_flags( color_config, sm, + fluent_bundle, fallback_bundle, HandlerFlags { can_emit_warnings, treat_err_as_bug, ..Default::default() }, ) @@ -557,12 +560,14 @@ impl Handler { pub fn with_tty_emitter_and_flags( color_config: ColorConfig, sm: Option<Lrc<SourceMap>>, + fluent_bundle: Option<Lrc<FluentBundle>>, fallback_bundle: Lrc<FluentBundle>, flags: HandlerFlags, ) -> Self { let emitter = Box::new(EmitterWriter::stderr( color_config, sm, + fluent_bundle, fallback_bundle, false, false, |
