mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
bootstrap: Try to track down why initial_libdir
sometimes fails
Determining this path occasionally fails locally for unknown reasons, resulting in the build failing with an unhelpful `StripPrefixError(())` panic message. In order to track down why that's happening, include some relevant information in the panic message when that failure occurs.
This commit is contained in:
parent
0d634185df
commit
21edc73517
@ -332,14 +332,20 @@ impl Build {
|
||||
.trim()
|
||||
.to_string();
|
||||
|
||||
let initial_libdir = initial_target_dir
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.strip_prefix(&initial_sysroot)
|
||||
.unwrap()
|
||||
.to_path_buf();
|
||||
// FIXME(Zalathar): Determining this path occasionally fails locally for
|
||||
// unknown reasons, so we print some extra context to help track down why.
|
||||
let find_initial_libdir = || {
|
||||
let initial_libdir =
|
||||
initial_target_dir.parent()?.parent()?.strip_prefix(&initial_sysroot).ok()?;
|
||||
Some(initial_libdir.to_path_buf())
|
||||
};
|
||||
let Some(initial_libdir) = find_initial_libdir() else {
|
||||
panic!(
|
||||
"couldn't determine `initial_libdir` \
|
||||
from target dir {initial_target_dir:?} \
|
||||
and sysroot {initial_sysroot:?}"
|
||||
)
|
||||
};
|
||||
|
||||
let version = std::fs::read_to_string(src.join("src").join("version"))
|
||||
.expect("failed to read src/version");
|
||||
|
Loading…
Reference in New Issue
Block a user