Skip to content

Commit 376c944

Browse files
authored
Rollup merge of #113048 - psumbera:solaris-bootstrap-cfgs, r=ozkanonur
Fix build on Solaris where fd-lock cannot be used. This fixes build regression after e7e584b. Resolves #113085
2 parents bad0688 + 35cfac1 commit 376c944

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/bootstrap/bin/main.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
//! parent directory, and otherwise documentation can be found throughout the `build`
66
//! directory in each respective module.
77
8-
use std::fs::OpenOptions;
8+
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
99
use std::io::Write;
10-
use std::{env, fs, process};
10+
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
11+
use std::process;
12+
use std::{env, fs};
1113

1214
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
1315
use bootstrap::t;
@@ -32,7 +34,7 @@ fn main() {
3234
};
3335

3436
build_lock =
35-
fd_lock::RwLock::new(t!(OpenOptions::new().write(true).create(true).open(&path)));
37+
fd_lock::RwLock::new(t!(fs::OpenOptions::new().write(true).create(true).open(&path)));
3638
_build_lock_guard = match build_lock.try_write() {
3739
Ok(mut lock) => {
3840
t!(lock.write(&process::id().to_string().as_ref()));
@@ -85,7 +87,7 @@ fn main() {
8587
// HACK: Since the commit script uses hard links, we can't actually tell if it was installed by x.py setup or not.
8688
// We could see if it's identical to src/etc/pre-push.sh, but pre-push may have been modified in the meantime.
8789
// Instead, look for this comment, which is almost certainly not in any custom hook.
88-
if std::fs::read_to_string(pre_commit).map_or(false, |contents| {
90+
if fs::read_to_string(pre_commit).map_or(false, |contents| {
8991
contents.contains("https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570")
9092
}) {
9193
println!(

0 commit comments

Comments
 (0)