Skip to content

Commit 13d56dc

Browse files
Use a Vec in rustc_interface::Config::locale_resources
This allows a third-party tool to injects its own resources, when receiving the config via `rustc_driver::Callbacks::config`.
1 parent eb33b43 commit 13d56dc

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

compiler/rustc_driver_impl/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn run_compiler(
321321
output_dir: odir,
322322
ice_file,
323323
file_loader,
324-
locale_resources: DEFAULT_LOCALE_RESOURCES,
324+
locale_resources: DEFAULT_LOCALE_RESOURCES.to_vec(),
325325
lint_caps: Default::default(),
326326
psess_created: None,
327327
hash_untracked_state: None,

compiler/rustc_interface/src/interface.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ pub struct Config {
311311
pub output_file: Option<OutFileName>,
312312
pub ice_file: Option<PathBuf>,
313313
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
314-
pub locale_resources: &'static [&'static str],
314+
/// The list of fluent resources, used for lints declared with
315+
/// [`Diagnostic`](rustc_errors::Diagnostic) and [`LintDiagnostic`](rustc_errors::LintDiagnostic).
316+
pub locale_resources: Vec<&'static str>,
315317

316318
pub lint_caps: FxHashMap<lint::LintId, lint::Level>,
317319

src/librustdoc/core.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub(crate) fn create_config(
262262
output_file: None,
263263
output_dir: None,
264264
file_loader: None,
265-
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES,
265+
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
266266
lint_caps,
267267
psess_created: None,
268268
hash_untracked_state: None,

src/librustdoc/doctest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, options: RustdocOptions) -> Result<()
139139
output_file: None,
140140
output_dir: None,
141141
file_loader: None,
142-
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES,
142+
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
143143
lint_caps,
144144
psess_created: None,
145145
hash_untracked_state: None,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf, linker: Option<&Path
6565
output_dir: None,
6666
ice_file: None,
6767
file_loader: None,
68-
locale_resources: &[],
68+
locale_resources: Vec::new(),
6969
lint_caps: Default::default(),
7070
psess_created: None,
7171
hash_untracked_state: None,

0 commit comments

Comments
 (0)