about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-03-28 09:36:20 +0100
committerDavid Wood <david.wood@huawei.com>2022-04-05 07:01:02 +0100
commit865386e9dcac24966ac09062e910482346cd40f4 (patch)
tree4416215b57ee35d4f7ca96425a790733f5f78ae7
parent41d1340505d37058349ba016c9dc8c3d52f49bf3 (diff)
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>
-rw-r--r--clippy_lints/src/doc.rs4
-rw-r--r--src/driver.rs4
2 files changed, 6 insertions, 2 deletions
diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs
index b836363b31b..e08e9e49993 100644
--- a/clippy_lints/src/doc.rs
+++ b/clippy_lints/src/doc.rs
@@ -621,10 +621,12 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
                 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,
diff --git a/src/driver.rs b/src/driver.rs
index bfce787af5e..f04535b2bea 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -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,