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`.
This commit is contained in:
arnaudgolfouse 2024-09-05 16:00:48 +02:00
parent eb33b43bab
commit 13d56dc160
5 changed files with 7 additions and 5 deletions

View File

@ -321,7 +321,7 @@ fn run_compiler(
output_dir: odir, output_dir: odir,
ice_file, ice_file,
file_loader, file_loader,
locale_resources: DEFAULT_LOCALE_RESOURCES, locale_resources: DEFAULT_LOCALE_RESOURCES.to_vec(),
lint_caps: Default::default(), lint_caps: Default::default(),
psess_created: None, psess_created: None,
hash_untracked_state: None, hash_untracked_state: None,

View File

@ -311,7 +311,9 @@ pub struct Config {
pub output_file: Option<OutFileName>, pub output_file: Option<OutFileName>,
pub ice_file: Option<PathBuf>, pub ice_file: Option<PathBuf>,
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>, pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
pub locale_resources: &'static [&'static str], /// The list of fluent resources, used for lints declared with
/// [`Diagnostic`](rustc_errors::Diagnostic) and [`LintDiagnostic`](rustc_errors::LintDiagnostic).
pub locale_resources: Vec<&'static str>,
pub lint_caps: FxHashMap<lint::LintId, lint::Level>, pub lint_caps: FxHashMap<lint::LintId, lint::Level>,

View File

@ -262,7 +262,7 @@ pub(crate) fn create_config(
output_file: None, output_file: None,
output_dir: None, output_dir: None,
file_loader: None, file_loader: None,
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES, locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
lint_caps, lint_caps,
psess_created: None, psess_created: None,
hash_untracked_state: None, hash_untracked_state: None,

View File

@ -139,7 +139,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, options: RustdocOptions) -> Result<()
output_file: None, output_file: None,
output_dir: None, output_dir: None,
file_loader: None, file_loader: None,
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES, locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(),
lint_caps, lint_caps,
psess_created: None, psess_created: None,
hash_untracked_state: None, hash_untracked_state: None,

View File

@ -65,7 +65,7 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf, linker: Option<&Path
output_dir: None, output_dir: None,
ice_file: None, ice_file: None,
file_loader: None, file_loader: None,
locale_resources: &[], locale_resources: Vec::new(),
lint_caps: Default::default(), lint_caps: Default::default(),
psess_created: None, psess_created: None,
hash_untracked_state: None, hash_untracked_state: None,