@@ -8,6 +8,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
88use rustc_data_structures:: jobserver:: { self , Proxy } ;
99use rustc_data_structures:: stable_hasher:: StableHasher ;
1010use rustc_errors:: registry:: Registry ;
11+ use rustc_errors:: translation:: Translator ;
1112use rustc_errors:: { DiagCtxtHandle , ErrorGuaranteed } ;
1213use rustc_lint:: LintStore ;
1314use rustc_middle:: ty;
@@ -316,6 +317,28 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
316317 check_cfg
317318}
318319
320+ pub fn default_translator ( ) -> Translator {
321+ Translator :: with_fallback_bundle ( DEFAULT_LOCALE_RESOURCES . to_vec ( ) , false )
322+ }
323+
324+ static DEFAULT_LOCALE_RESOURCES : & [ & str ] = & [
325+ // tidy-alphabetical-start
326+ rustc_ast_passes:: DEFAULT_LOCALE_RESOURCE ,
327+ rustc_borrowck:: DEFAULT_LOCALE_RESOURCE ,
328+ rustc_builtin_macros:: DEFAULT_LOCALE_RESOURCE ,
329+ rustc_const_eval:: DEFAULT_LOCALE_RESOURCE ,
330+ rustc_errors:: DEFAULT_LOCALE_RESOURCE ,
331+ rustc_hir_analysis:: DEFAULT_LOCALE_RESOURCE ,
332+ rustc_lint:: DEFAULT_LOCALE_RESOURCE ,
333+ rustc_middle:: DEFAULT_LOCALE_RESOURCE ,
334+ rustc_mir_build:: DEFAULT_LOCALE_RESOURCE ,
335+ rustc_parse:: DEFAULT_LOCALE_RESOURCE ,
336+ rustc_passes:: DEFAULT_LOCALE_RESOURCE ,
337+ rustc_pattern_analysis:: DEFAULT_LOCALE_RESOURCE ,
338+ rustc_trait_selection:: DEFAULT_LOCALE_RESOURCE ,
339+ // tidy-alphabetical-end
340+ ] ;
341+
319342/// The compiler configuration
320343pub struct Config {
321344 /// Command line options
@@ -335,9 +358,6 @@ pub struct Config {
335358 /// bjorn3 for "hooking rust-analyzer's VFS into rustc at some point for
336359 /// running rustc without having to save". (See #102759.)
337360 pub file_loader : Option < Box < dyn FileLoader + Send + Sync > > ,
338- /// The list of fluent resources, used for lints declared with
339- /// [`Diagnostic`](rustc_errors::Diagnostic) and [`LintDiagnostic`](rustc_errors::LintDiagnostic).
340- pub locale_resources : Vec < & ' static str > ,
341361
342362 pub lint_caps : FxHashMap < lint:: LintId , lint:: Level > ,
343363
@@ -465,7 +485,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
465485 } ,
466486 bundle,
467487 config. registry ,
468- config . locale_resources ,
488+ DEFAULT_LOCALE_RESOURCES . to_owned ( ) ,
469489 config. lint_caps ,
470490 target,
471491 util:: rustc_version_str ( ) . unwrap_or ( "unknown" ) ,
0 commit comments