errors: lazily load fallback fluent bundle
Loading the fallback bundle in compilation sessions that won't go on to emit any errors unnecessarily degrades compile time performance, so lazily create the Fluent bundle when it is first required. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
f6cef572d6
commit
9bfe0e39e4
19 changed files with 94 additions and 81 deletions
|
@ -173,8 +173,7 @@ pub struct ParseSess {
|
|||
impl ParseSess {
|
||||
/// Used for testing.
|
||||
pub fn new(file_path_mapping: FilePathMapping) -> Self {
|
||||
let fallback_bundle =
|
||||
fallback_fluent_bundle(false).expect("failed to load fallback fluent bundle");
|
||||
let fallback_bundle = fallback_fluent_bundle(rustc_errors::DEFAULT_LOCALE_RESOURCES, false);
|
||||
let sm = Lrc::new(SourceMap::new(file_path_mapping));
|
||||
let handler = Handler::with_tty_emitter(
|
||||
ColorConfig::Auto,
|
||||
|
@ -211,8 +210,7 @@ impl ParseSess {
|
|||
}
|
||||
|
||||
pub fn with_silent_emitter(fatal_note: Option<String>) -> Self {
|
||||
let fallback_bundle =
|
||||
fallback_fluent_bundle(false).expect("failed to load fallback fluent bundle");
|
||||
let fallback_bundle = fallback_fluent_bundle(rustc_errors::DEFAULT_LOCALE_RESOURCES, false);
|
||||
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
let fatal_handler =
|
||||
Handler::with_tty_emitter(ColorConfig::Auto, false, None, None, None, fallback_bundle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue