Make opts.maybe_sysroot non-optional
build_session_options always uses materialize_sysroot anyway.
This commit is contained in:
parent
57a4736e9f
commit
b54398e4ea
9 changed files with 20 additions and 14 deletions
|
@ -107,7 +107,7 @@ impl From<Vec<FluentError>> for TranslationBundleError {
|
|||
/// (overriding any conflicting messages).
|
||||
#[instrument(level = "trace")]
|
||||
pub fn fluent_bundle(
|
||||
mut user_provided_sysroot: Option<PathBuf>,
|
||||
mut user_provided_sysroot: PathBuf,
|
||||
mut sysroot_candidates: Vec<PathBuf>,
|
||||
requested_locale: Option<LanguageIdentifier>,
|
||||
additional_ftl_path: Option<&Path>,
|
||||
|
@ -142,7 +142,9 @@ pub fn fluent_bundle(
|
|||
// If the user requests the default locale then don't try to load anything.
|
||||
if let Some(requested_locale) = requested_locale {
|
||||
let mut found_resources = false;
|
||||
for sysroot in user_provided_sysroot.iter_mut().chain(sysroot_candidates.iter_mut()) {
|
||||
for sysroot in
|
||||
Some(&mut user_provided_sysroot).into_iter().chain(sysroot_candidates.iter_mut())
|
||||
{
|
||||
sysroot.push("share");
|
||||
sysroot.push("locale");
|
||||
sysroot.push(requested_locale.to_string());
|
||||
|
|
|
@ -18,7 +18,7 @@ use rustc_parse::parser::attr::AllowLeadingUnsafe;
|
|||
use rustc_query_impl::QueryCtxt;
|
||||
use rustc_query_system::query::print_query_stack;
|
||||
use rustc_session::config::{self, Cfg, CheckCfg, ExpectedValues, Input, OutFileName};
|
||||
use rustc_session::filesearch::{self, sysroot_candidates};
|
||||
use rustc_session::filesearch::sysroot_candidates;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, lint};
|
||||
use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMapInputs};
|
||||
|
@ -390,7 +390,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
|
|||
|
||||
crate::callbacks::setup_callbacks();
|
||||
|
||||
let sysroot = filesearch::materialize_sysroot(config.opts.maybe_sysroot.clone());
|
||||
let sysroot = config.opts.sysroot.clone();
|
||||
let target = config::build_target_config(&early_dcx, &config.opts.target_triple, &sysroot);
|
||||
let file_loader = config.file_loader.unwrap_or_else(|| Box::new(RealFileLoader));
|
||||
let path_mapping = config.opts.file_path_mapping();
|
||||
|
@ -424,7 +424,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
|
|||
let temps_dir = config.opts.unstable_opts.temps_dir.as_deref().map(PathBuf::from);
|
||||
|
||||
let bundle = match rustc_errors::fluent_bundle(
|
||||
config.opts.maybe_sysroot.clone(),
|
||||
config.opts.sysroot.clone(),
|
||||
sysroot_candidates().to_vec(),
|
||||
config.opts.unstable_opts.translate_lang.clone(),
|
||||
config.opts.unstable_opts.translate_additional_ftl.as_deref(),
|
||||
|
|
|
@ -21,7 +21,7 @@ use rustc_session::config::{
|
|||
use rustc_session::lint::Level;
|
||||
use rustc_session::search_paths::SearchPath;
|
||||
use rustc_session::utils::{CanonicalizedPath, NativeLib, NativeLibKind};
|
||||
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, build_session, filesearch, getopts};
|
||||
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, build_session, getopts};
|
||||
use rustc_span::edition::{DEFAULT_EDITION, Edition};
|
||||
use rustc_span::source_map::{RealFileLoader, SourceMapInputs};
|
||||
use rustc_span::{FileName, SourceFileHashAlgorithm, sym};
|
||||
|
@ -41,7 +41,7 @@ where
|
|||
|
||||
let matches = optgroups().parse(args).unwrap();
|
||||
let sessopts = build_session_options(&mut early_dcx, &matches);
|
||||
let sysroot = filesearch::materialize_sysroot(sessopts.maybe_sysroot.clone());
|
||||
let sysroot = sessopts.sysroot.clone();
|
||||
let target =
|
||||
rustc_session::config::build_target_config(&early_dcx, &sessopts.target_triple, &sysroot);
|
||||
let hash_kind = sessopts.unstable_opts.src_hash_algorithm(&target);
|
||||
|
|
|
@ -1214,7 +1214,7 @@ impl Default for Options {
|
|||
describe_lints: false,
|
||||
output_types: OutputTypes(BTreeMap::new()),
|
||||
search_paths: vec![],
|
||||
maybe_sysroot: None,
|
||||
sysroot: filesearch::materialize_sysroot(None),
|
||||
target_triple: TargetTuple::from_tuple(host_tuple()),
|
||||
test: false,
|
||||
incremental: None,
|
||||
|
@ -2618,7 +2618,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
|
|||
describe_lints,
|
||||
output_types,
|
||||
search_paths,
|
||||
maybe_sysroot: Some(sysroot),
|
||||
sysroot,
|
||||
target_triple,
|
||||
test,
|
||||
incremental,
|
||||
|
|
|
@ -333,7 +333,7 @@ top_level_options!(
|
|||
output_types: OutputTypes [TRACKED],
|
||||
search_paths: Vec<SearchPath> [UNTRACKED],
|
||||
libs: Vec<NativeLib> [TRACKED],
|
||||
maybe_sysroot: Option<PathBuf> [UNTRACKED],
|
||||
sysroot: PathBuf [UNTRACKED],
|
||||
|
||||
target_triple: TargetTuple [TRACKED],
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue