Skip to content

Commit 8f3dce7

Browse files
committed
Hard code DEFAULT_LOCALE_RESOURCES in rustc_interface
locale_resources will no longer be used at all soon, so no need for custom drivers to have the ability to define their own locale_resources. Also hard code report_ice to not use any locale resources. It only emits diagnostics that have already been ported to inline fluent messages.
1 parent 8bccf12 commit 8f3dce7

10 files changed

Lines changed: 32 additions & 59 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3774,11 +3774,7 @@ dependencies = [
37743774
"libc",
37753775
"rustc_abi",
37763776
"rustc_ast",
3777-
"rustc_ast_lowering",
3778-
"rustc_ast_passes",
37793777
"rustc_ast_pretty",
3780-
"rustc_borrowck",
3781-
"rustc_builtin_macros",
37823778
"rustc_codegen_ssa",
37833779
"rustc_const_eval",
37843780
"rustc_data_structures",
@@ -3787,7 +3783,6 @@ dependencies = [
37873783
"rustc_feature",
37883784
"rustc_hir_analysis",
37893785
"rustc_hir_pretty",
3790-
"rustc_hir_typeck",
37913786
"rustc_index",
37923787
"rustc_interface",
37933788
"rustc_lexer",
@@ -3799,14 +3794,11 @@ dependencies = [
37993794
"rustc_mir_build",
38003795
"rustc_mir_transform",
38013796
"rustc_parse",
3802-
"rustc_passes",
3803-
"rustc_pattern_analysis",
38043797
"rustc_public",
38053798
"rustc_resolve",
38063799
"rustc_session",
38073800
"rustc_span",
38083801
"rustc_target",
3809-
"rustc_trait_selection",
38103802
"serde_json",
38113803
"shlex",
38123804
"tracing",
@@ -4124,6 +4116,7 @@ dependencies = [
41244116
"rustc_monomorphize",
41254117
"rustc_parse",
41264118
"rustc_passes",
4119+
"rustc_pattern_analysis",
41274120
"rustc_privacy",
41284121
"rustc_query_impl",
41294122
"rustc_query_system",

compiler/rustc_driver_impl/Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ anstyle = "1.0.13"
99
jiff = { version = "0.2.5", default-features = false, features = ["std"] }
1010
rustc_abi = { path = "../rustc_abi" }
1111
rustc_ast = { path = "../rustc_ast" }
12-
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
13-
rustc_ast_passes = { path = "../rustc_ast_passes" }
1412
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
15-
rustc_borrowck = { path = "../rustc_borrowck" }
16-
rustc_builtin_macros = { path = "../rustc_builtin_macros" }
1713
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
1814
rustc_const_eval = { path = "../rustc_const_eval" }
1915
rustc_data_structures = { path = "../rustc_data_structures" }
@@ -22,7 +18,6 @@ rustc_expand = { path = "../rustc_expand" }
2218
rustc_feature = { path = "../rustc_feature" }
2319
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
2420
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
25-
rustc_hir_typeck = { path = "../rustc_hir_typeck" }
2621
rustc_index = { path = "../rustc_index" }
2722
rustc_interface = { path = "../rustc_interface" }
2823
rustc_lexer = { path = "../rustc_lexer" }
@@ -34,14 +29,11 @@ rustc_middle = { path = "../rustc_middle" }
3429
rustc_mir_build = { path = "../rustc_mir_build" }
3530
rustc_mir_transform = { path = "../rustc_mir_transform" }
3631
rustc_parse = { path = "../rustc_parse" }
37-
rustc_passes = { path = "../rustc_passes" }
38-
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
3932
rustc_public = { path = "../rustc_public", features = ["rustc_internal"] }
4033
rustc_resolve = { path = "../rustc_resolve" }
4134
rustc_session = { path = "../rustc_session" }
4235
rustc_span = { path = "../rustc_span" }
4336
rustc_target = { path = "../rustc_target" }
44-
rustc_trait_selection = { path = "../rustc_trait_selection" }
4537
serde_json = "1.0.59"
4638
shlex = "1.0"
4739
tracing = { version = "0.1.35" }

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -108,35 +108,6 @@ use crate::session_diagnostics::{
108108
RLinkWrongFileType, RlinkCorruptFile, RlinkNotAFile, RlinkUnableToRead, UnstableFeatureUsage,
109109
};
110110

111-
pub fn default_translator() -> Translator {
112-
Translator::with_fallback_bundle(DEFAULT_LOCALE_RESOURCES.to_vec(), false)
113-
}
114-
115-
pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
116-
// tidy-alphabetical-start
117-
rustc_ast_lowering::DEFAULT_LOCALE_RESOURCE,
118-
rustc_ast_passes::DEFAULT_LOCALE_RESOURCE,
119-
rustc_borrowck::DEFAULT_LOCALE_RESOURCE,
120-
rustc_builtin_macros::DEFAULT_LOCALE_RESOURCE,
121-
rustc_codegen_ssa::DEFAULT_LOCALE_RESOURCE,
122-
rustc_const_eval::DEFAULT_LOCALE_RESOURCE,
123-
rustc_errors::DEFAULT_LOCALE_RESOURCE,
124-
rustc_expand::DEFAULT_LOCALE_RESOURCE,
125-
rustc_hir_analysis::DEFAULT_LOCALE_RESOURCE,
126-
rustc_hir_typeck::DEFAULT_LOCALE_RESOURCE,
127-
rustc_lint::DEFAULT_LOCALE_RESOURCE,
128-
rustc_metadata::DEFAULT_LOCALE_RESOURCE,
129-
rustc_middle::DEFAULT_LOCALE_RESOURCE,
130-
rustc_mir_build::DEFAULT_LOCALE_RESOURCE,
131-
rustc_mir_transform::DEFAULT_LOCALE_RESOURCE,
132-
rustc_parse::DEFAULT_LOCALE_RESOURCE,
133-
rustc_passes::DEFAULT_LOCALE_RESOURCE,
134-
rustc_pattern_analysis::DEFAULT_LOCALE_RESOURCE,
135-
rustc_resolve::DEFAULT_LOCALE_RESOURCE,
136-
rustc_trait_selection::DEFAULT_LOCALE_RESOURCE,
137-
// tidy-alphabetical-end
138-
];
139-
140111
/// Exit status code used for successful compilation and help output.
141112
pub const EXIT_SUCCESS: i32 = 0;
142113

@@ -247,7 +218,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
247218
output_dir: odir,
248219
ice_file,
249220
file_loader: None,
250-
locale_resources: DEFAULT_LOCALE_RESOURCES.to_vec(),
251221
lint_caps: Default::default(),
252222
psess_created: None,
253223
hash_untracked_state: None,
@@ -1557,7 +1527,7 @@ fn report_ice(
15571527
extra_info: fn(&DiagCtxt),
15581528
using_internal_features: &AtomicBool,
15591529
) {
1560-
let translator = default_translator();
1530+
let translator = Translator::with_fallback_bundle(vec![], false);
15611531
let emitter =
15621532
Box::new(rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter::new(
15631533
stderr_destination(rustc_errors::ColorConfig::Auto),

compiler/rustc_interface/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ rustc_mir_transform = { path = "../rustc_mir_transform" }
3333
rustc_monomorphize = { path = "../rustc_monomorphize" }
3434
rustc_parse = { path = "../rustc_parse" }
3535
rustc_passes = { path = "../rustc_passes" }
36+
rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
3637
rustc_privacy = { path = "../rustc_privacy" }
3738
rustc_query_impl = { path = "../rustc_query_impl" }
3839
rustc_query_system = { path = "../rustc_query_system" }

compiler/rustc_interface/src/interface.rs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,31 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
316316
check_cfg
317317
}
318318

319+
static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
320+
// tidy-alphabetical-start
321+
rustc_ast_lowering::DEFAULT_LOCALE_RESOURCE,
322+
rustc_ast_passes::DEFAULT_LOCALE_RESOURCE,
323+
rustc_borrowck::DEFAULT_LOCALE_RESOURCE,
324+
rustc_builtin_macros::DEFAULT_LOCALE_RESOURCE,
325+
rustc_codegen_ssa::DEFAULT_LOCALE_RESOURCE,
326+
rustc_const_eval::DEFAULT_LOCALE_RESOURCE,
327+
rustc_errors::DEFAULT_LOCALE_RESOURCE,
328+
rustc_expand::DEFAULT_LOCALE_RESOURCE,
329+
rustc_hir_analysis::DEFAULT_LOCALE_RESOURCE,
330+
rustc_hir_typeck::DEFAULT_LOCALE_RESOURCE,
331+
rustc_lint::DEFAULT_LOCALE_RESOURCE,
332+
rustc_metadata::DEFAULT_LOCALE_RESOURCE,
333+
rustc_middle::DEFAULT_LOCALE_RESOURCE,
334+
rustc_mir_build::DEFAULT_LOCALE_RESOURCE,
335+
rustc_mir_transform::DEFAULT_LOCALE_RESOURCE,
336+
rustc_parse::DEFAULT_LOCALE_RESOURCE,
337+
rustc_passes::DEFAULT_LOCALE_RESOURCE,
338+
rustc_pattern_analysis::DEFAULT_LOCALE_RESOURCE,
339+
rustc_resolve::DEFAULT_LOCALE_RESOURCE,
340+
rustc_trait_selection::DEFAULT_LOCALE_RESOURCE,
341+
// tidy-alphabetical-end
342+
];
343+
319344
/// The compiler configuration
320345
pub struct Config {
321346
/// Command line options
@@ -335,9 +360,6 @@ pub struct Config {
335360
/// bjorn3 for "hooking rust-analyzer's VFS into rustc at some point for
336361
/// running rustc without having to save". (See #102759.)
337362
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>,
341363

342364
pub lint_caps: FxHashMap<lint::LintId, lint::Level>,
343365

@@ -465,7 +487,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
465487
},
466488
bundle,
467489
config.registry,
468-
config.locale_resources,
490+
DEFAULT_LOCALE_RESOURCES.to_owned(),
469491
config.lint_caps,
470492
target,
471493
util::rustc_version_str().unwrap_or("unknown"),

src/doc/rustc-dev-guide/examples/rustc-interface-example.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ fn main() {
3232
"#
3333
.into(),
3434
},
35-
output_dir: None, // Option<PathBuf>
36-
output_file: None, // Option<PathBuf>
37-
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
38-
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_owned(),
35+
output_dir: None, // Option<PathBuf>
36+
output_file: None, // Option<PathBuf>
37+
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
3938
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
4039
// This is a callback from the driver that is called when [`ParseSess`] is created.
4140
psess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>

src/doc/rustc-dev-guide/examples/rustc-interface-getting-diagnostics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ fn main() {
6666
output_dir: None,
6767
output_file: None,
6868
file_loader: None,
69-
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_owned(),
7069
lint_caps: rustc_hash::FxHashMap::default(),
7170
psess_created: Some(Box::new(|parse_sess| {
7271
parse_sess.dcx().set_emitter(Box::new(DebugEmitter {

src/librustdoc/core.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ pub(crate) fn create_config(
289289
output_file: None,
290290
output_dir: None,
291291
file_loader: None,
292-
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
293292
lint_caps,
294293
psess_created: None,
295294
hash_untracked_state: None,

src/librustdoc/doctest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions
188188
output_file: None,
189189
output_dir: None,
190190
file_loader: None,
191-
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
192191
lint_caps,
193192
psess_created: None,
194193
hash_untracked_state: None,

tests/ui-fulldeps/run-compiler-twice.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ fn compile(code: String, output: PathBuf, sysroot: Sysroot, linker: Option<&Path
6464
output_dir: None,
6565
ice_file: None,
6666
file_loader: None,
67-
locale_resources: Vec::new(),
6867
lint_caps: Default::default(),
6968
psess_created: None,
7069
hash_untracked_state: None,

0 commit comments

Comments
 (0)