about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/json/tests.rs
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-10-13 10:13:02 +0100
committerDavid Wood <david.wood@huawei.com>2023-02-22 09:15:53 +0000
commitd1fcf611175e695c35c6cc0537d710277c1a5c6f (patch)
tree7f3dfc8cdfa379edef39ff5f8f54fdbf88668fc5 /compiler/rustc_errors/src/json/tests.rs
parentf9216b75646cde0c4c69ae00232778a47fc893d3 (diff)
downloadrust-d1fcf611175e695c35c6cc0537d710277c1a5c6f.tar.gz
rust-d1fcf611175e695c35c6cc0537d710277c1a5c6f.zip
errors: generate typed identifiers in each crate
Instead of loading the Fluent resources for every crate in
`rustc_error_messages`, each crate generates typed identifiers for its
own diagnostics and creates a static which are pulled together in the
`rustc_driver` crate and provided to the diagnostic emitter.

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_errors/src/json/tests.rs')
-rw-r--r--compiler/rustc_errors/src/json/tests.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_errors/src/json/tests.rs b/compiler/rustc_errors/src/json/tests.rs
index f161532d3b7..bbfad26c6f0 100644
--- a/compiler/rustc_errors/src/json/tests.rs
+++ b/compiler/rustc_errors/src/json/tests.rs
@@ -42,11 +42,11 @@ impl<T: Write> Write for Shared<T> {
 
 /// Test the span yields correct positions in JSON.
 fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
+    static TEST_LOCALE_RESOURCES: &[&str] = &[crate::DEFAULT_LOCALE_RESOURCE];
     rustc_span::create_default_session_globals_then(|| {
         let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
         sm.new_source_file(Path::new("test.rs").to_owned().into(), code.to_owned());
-        let fallback_bundle =
-            crate::fallback_fluent_bundle(rustc_error_messages::DEFAULT_LOCALE_RESOURCES, false);
+        let fallback_bundle = crate::fallback_fluent_bundle(TEST_LOCALE_RESOURCES, false);
 
         let output = Arc::new(Mutex::new(Vec::new()));
         let je = JsonEmitter::new(