Skip to content

Commit a377ebc

Browse files
committed
Auto merge of rust-lang#95968 - davidtwco:translation-lazy-fallback, r=oli-obk
errors: lazily load fallback fluent bundle Addresses (hopefully) rust-lang#95667 (comment). 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. r? `@ghost` (just for perf initially)
2 parents 27634b0 + 5b7df24 commit a377ebc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

clippy_lints/src/doc.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,10 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
621621
let filename = FileName::anon_source_code(&code);
622622

623623
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
624-
let fallback_bundle =
625-
rustc_errors::fallback_fluent_bundle(false).expect("failed to load fallback fluent bundle");
624+
let fallback_bundle = rustc_errors::fallback_fluent_bundle(
625+
rustc_errors::DEFAULT_LOCALE_RESOURCES,
626+
false
627+
);
626628
let emitter = EmitterWriter::new(
627629
Box::new(io::sink()),
628630
None,

src/driver.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
165165
// Separate the output with an empty line
166166
eprintln!();
167167

168-
let fallback_bundle = rustc_errors::fallback_fluent_bundle(false).expect("failed to load fallback fluent bundle");
168+
let fallback_bundle =
169+
rustc_errors::fallback_fluent_bundle(rustc_errors::DEFAULT_LOCALE_RESOURCES, false);
169170
let emitter = Box::new(rustc_errors::emitter::EmitterWriter::stderr(
170171
rustc_errors::ColorConfig::Auto,
171172
None,

0 commit comments

Comments
 (0)