diff options
| author | bors <bors@rust-lang.org> | 2023-02-21 23:24:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-21 23:24:59 +0000 |
| commit | 375d5ace705f8494af06b545291d64486fbada06 (patch) | |
| tree | 8e6ceef6a8e5e1d8466a2db7c38e622094d5d443 /src/bootstrap/lib.rs | |
| parent | 246eae2fab54a5139365c4e1a08c5724fb385fbf (diff) | |
| parent | 6ca499bf2b3da83d60062da649805c36c03ce194 (diff) | |
| download | rust-375d5ace705f8494af06b545291d64486fbada06.tar.gz rust-375d5ace705f8494af06b545291d64486fbada06.zip | |
Auto merge of #108302 - Kobzol:revert-107834, r=albertlarsan68
Revert #107834 This reverts commit [41c6c5d4996728b5a635319ef9b077a3d0ccc480](https://github.com/rust-lang/rust/pull/107834). Trying to check if this fixes building `rustc` for perf bot.
Diffstat (limited to 'src/bootstrap/lib.rs')
| -rw-r--r-- | src/bootstrap/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index f753720b353..f4abdf1cc57 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -20,6 +20,7 @@ use std::cell::{Cell, RefCell}; use std::collections::{HashMap, HashSet}; use std::env; use std::fs::{self, File}; +use std::io; use std::io::ErrorKind; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; @@ -1406,7 +1407,7 @@ impl Build { src = t!(fs::canonicalize(src)); } else { let link = t!(fs::read_link(src)); - t!(self.config.symlink_file(link, dst)); + t!(self.symlink_file(link, dst)); return; } } @@ -1524,6 +1525,14 @@ impl Build { iter.map(|e| t!(e)).collect::<Vec<_>>().into_iter() } + fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(&self, src: P, link: Q) -> io::Result<()> { + #[cfg(unix)] + use std::os::unix::fs::symlink as symlink_file; + #[cfg(windows)] + use std::os::windows::fs::symlink_file; + if !self.config.dry_run() { symlink_file(src.as_ref(), link.as_ref()) } else { Ok(()) } + } + /// Returns if config.ninja is enabled, and checks for ninja existence, /// exiting with a nicer error message if not. fn ninja(&self) -> bool { |
