about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/json
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-06-20 13:36:01 -0400
committerGitHub <noreply@github.com>2025-06-20 13:36:01 -0400
commit38600a6640054dd4e04645eb74796cd053a70f06 (patch)
treee5ff94946a7abad06fe4f588e73ac9e74ce445b8 /compiler/rustc_errors/src/json
parent5d6ecf584e9c28e137daa4f82aee8ce0fb63c30a (diff)
parent3388d837850eebca505350bc25f017276551a955 (diff)
downloadrust-38600a6640054dd4e04645eb74796cd053a70f06.tar.gz
rust-38600a6640054dd4e04645eb74796cd053a70f06.zip
Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkov
Refactor Translator

My main motivation was to simplify the usage of `SilentEmitter` for users like rustfmt. A few refactoring opportunities arose along the way.

* Replace `Translate` trait with `Translator` struct
* Replace `Emitter: Translate` with `Emitter::translator`
* Split `SilentEmitter` into `FatalOnlyEmitter` and `SilentEmitter`
Diffstat (limited to 'compiler/rustc_errors/src/json')
-rw-r--r--compiler/rustc_errors/src/json/tests.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_errors/src/json/tests.rs b/compiler/rustc_errors/src/json/tests.rs
index 40973e8e5d8..8cf81f467d8 100644
--- a/compiler/rustc_errors/src/json/tests.rs
+++ b/compiler/rustc_errors/src/json/tests.rs
@@ -41,14 +41,14 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
     rustc_span::create_default_session_globals_then(|| {
         let sm = Arc::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(vec![crate::DEFAULT_LOCALE_RESOURCE], false);
+        let translator =
+            Translator::with_fallback_bundle(vec![crate::DEFAULT_LOCALE_RESOURCE], false);
 
         let output = Arc::new(Mutex::new(Vec::new()));
         let je = JsonEmitter::new(
             Box::new(Shared { data: output.clone() }),
             Some(sm),
-            fallback_bundle,
+            translator,
             true, // pretty
             HumanReadableErrorType::Short,
             ColorConfig::Never,