Skip to content

Commit fee75fb

Browse files
committed
Auto merge of #96905 - jyn514:revert-96803-faster-assemble, r=Mark-Simulacrum
Revert "Make "Assemble stage1 compiler" orders of magnitude faster" Reverts #96803. This caused `llvm-tools-nightly` to fail when installing with `rustup-toolchain-install-master` because of the presence of symlinks. I'm not sure how the symlinks got in there, but revert the PR for now while I figure it out. r? `@Mark-Simulacrum` cc `@RalfJung`
2 parents d4c3643 + 89e0c29 commit fee75fb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/bootstrap/lib.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -1497,14 +1497,20 @@ impl Build {
14971497
let dst = dstdir.join(src.file_name().unwrap());
14981498
self.verbose_than(1, &format!("Install {:?} to {:?}", src, dst));
14991499
t!(fs::create_dir_all(dstdir));
1500+
drop(fs::remove_file(&dst));
15001501
{
15011502
if !src.exists() {
15021503
panic!("Error: File \"{}\" not found!", src.display());
15031504
}
1504-
self.copy(src, &dst);
1505+
let metadata = t!(src.symlink_metadata());
1506+
if let Err(e) = fs::copy(&src, &dst) {
1507+
panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e)
1508+
}
1509+
t!(fs::set_permissions(&dst, metadata.permissions()));
1510+
let atime = FileTime::from_last_access_time(&metadata);
1511+
let mtime = FileTime::from_last_modification_time(&metadata);
1512+
t!(filetime::set_file_times(&dst, atime, mtime));
15051513
}
1506-
// NOTE: when using hard-links, this will also update the permissions on the original file.
1507-
// We never use permissions that are more restrictive than the original, so this shouldn't cause any issues.
15081514
chmod(&dst, perms);
15091515
}
15101516

0 commit comments

Comments
 (0)