]> git.lizzy.rs Git - rust.git/commitdiff
errors: implement sysroot/testing bundle loading
authorDavid Wood <david.wood@huawei.com>
Mon, 28 Mar 2022 08:36:20 +0000 (09:36 +0100)
committerDavid Wood <david.wood@huawei.com>
Tue, 5 Apr 2022 06:01:02 +0000 (07:01 +0100)
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>
clippy_lints/src/doc.rs
src/driver.rs

index b836363b31b556c85b48af114b0d69c8778723f3..e08e9e499938a7f4b108022559378d82ed3c79a8 100644 (file)
@@ -621,10 +621,12 @@ fn has_needless_main(code: String, edition: Edition) -> bool {
                 let filename = FileName::anon_source_code(&code);
 
                 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(
                     Box::new(io::sink()),
                     None,
+                    None,
                     fallback_bundle,
                     false,
                     false,
index bfce787af5ea826d37896a20806d3f9861b5ce5d..f04535b2bea0b8d2bc2539bd36f30ee10c6c4089 100644 (file)
@@ -165,10 +165,12 @@ fn report_clippy_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
     // Separate the output with an empty line
     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(
         rustc_errors::ColorConfig::Auto,
         None,
+        None,
         fallback_bundle,
         false,
         false,