@@ -6,7 +6,7 @@ pub use crate::options::*;
66use crate :: errors:: FileWriteFail ;
77use crate :: search_paths:: SearchPath ;
88use crate :: utils:: { CanonicalizedPath , NativeLib , NativeLibKind } ;
9- use crate :: { lint, HashStableContext } ;
9+ use crate :: { filesearch , lint, HashStableContext } ;
1010use crate :: { EarlyDiagCtxt , Session } ;
1111use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap , FxIndexSet } ;
1212use rustc_data_structures:: stable_hasher:: { StableOrd , ToStableHashKey } ;
@@ -2856,16 +2856,8 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
28562856
28572857 let logical_env = parse_logical_env ( early_dcx, matches) ;
28582858
2859- // Try to find a directory containing the Rust `src`, for more details see
2860- // the doc comment on the `real_rust_source_base_dir` field.
2861- let tmp_buf;
2862- let sysroot = match & sysroot_opt {
2863- Some ( s) => s,
2864- None => {
2865- tmp_buf = crate :: filesearch:: get_or_default_sysroot ( ) . expect ( "Failed finding sysroot" ) ;
2866- & tmp_buf
2867- }
2868- } ;
2859+ let sysroot = filesearch:: materialize_sysroot ( sysroot_opt) ;
2860+
28692861 let real_rust_source_base_dir = {
28702862 // This is the location used by the `rust-src` `rustup` component.
28712863 let mut candidate = sysroot. join ( "lib/rustlib/src/rust" ) ;
@@ -2909,7 +2901,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
29092901 describe_lints,
29102902 output_types,
29112903 search_paths,
2912- maybe_sysroot : sysroot_opt ,
2904+ maybe_sysroot : Some ( sysroot ) ,
29132905 target_triple,
29142906 test,
29152907 incremental,
0 commit comments