Replace implementation with @RUSTC_BUILTIN prefix substitution var
This commit is contained in:
parent
2fae4ee92e
commit
3d65c92040
@ -2824,6 +2824,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
|
||||
let logical_env = parse_logical_env(early_dcx, matches);
|
||||
|
||||
let sysroot = filesearch::materialize_sysroot(sysroot_opt);
|
||||
|
||||
let real_rust_source_base_dir = {
|
||||
// This is the location used by the `rust-src` `rustup` component.
|
||||
let mut candidate = sysroot.join("lib/rustlib/src/rust");
|
||||
|
@ -63,27 +63,20 @@ pub fn from_cli_opt(
|
||||
(PathKind::Framework, stripped)
|
||||
} else if let Some(stripped) = path.strip_prefix("all=") {
|
||||
(PathKind::All, stripped)
|
||||
} else if let Some(stripped) = path.strip_prefix("builtin:") {
|
||||
if stripped.contains(std::path::is_separator) {
|
||||
early_dcx.early_fatal("`-L builtin:` does not accept paths");
|
||||
}
|
||||
|
||||
let path =
|
||||
make_target_lib_path(sysroot, triple.triple()).join("builtin").join(stripped);
|
||||
if !path.is_dir() {
|
||||
early_dcx.early_fatal(format!("builtin:{stripped} does not exist"));
|
||||
}
|
||||
|
||||
return Self::new(PathKind::All, path);
|
||||
} else {
|
||||
(PathKind::All, path)
|
||||
};
|
||||
if path.is_empty() {
|
||||
let dir = match path.strip_prefix("@RUSTC_BUILTIN") {
|
||||
Some(stripped) => {
|
||||
make_target_lib_path(sysroot, triple.triple()).join("builtin").join(stripped)
|
||||
}
|
||||
None => PathBuf::from(path),
|
||||
};
|
||||
if dir.as_os_str().is_empty() {
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
early_dcx.early_fatal("empty search path given via `-L`");
|
||||
}
|
||||
|
||||
let dir = PathBuf::from(path);
|
||||
Self::new(kind, dir)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user