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>
This commit is contained in:
parent
41d1340505
commit
865386e9dc
@ -621,10 +621,12 @@ fn has_needless_main(code: String, edition: Edition) -> bool {
|
|||||||
let filename = FileName::anon_source_code(&code);
|
let filename = FileName::anon_source_code(&code);
|
||||||
|
|
||||||
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
||||||
let fallback_bundle = rustc_errors::fallback_fluent_bundle();
|
let fallback_bundle = rustc_errors::fallback_fluent_bundle()
|
||||||
|
.expect("failed to load fallback fluent bundle");
|
||||||
let emitter = EmitterWriter::new(
|
let emitter = EmitterWriter::new(
|
||||||
Box::new(io::sink()),
|
Box::new(io::sink()),
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
fallback_bundle,
|
fallback_bundle,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -165,10 +165,12 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
|
|||||||
// Separate the output with an empty line
|
// Separate the output with an empty line
|
||||||
eprintln!();
|
eprintln!();
|
||||||
|
|
||||||
let fallback_bundle = rustc_errors::fallback_fluent_bundle();
|
let fallback_bundle = rustc_errors::fallback_fluent_bundle()
|
||||||
|
.expect("failed to load fallback fluent bundle");
|
||||||
let emitter = Box::new(rustc_errors::emitter::EmitterWriter::stderr(
|
let emitter = Box::new(rustc_errors::emitter::EmitterWriter::stderr(
|
||||||
rustc_errors::ColorConfig::Auto,
|
rustc_errors::ColorConfig::Auto,
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
fallback_bundle,
|
fallback_bundle,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
Loading…
Reference in New Issue
Block a user