Skip to content

Commit d59f06f

Browse files
committed
Auto merge of rust-lang#119437 - matthiaskrgr:rollup-esf96p6, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#119158 (Clean up alloc::sync::Weak Clone implementation) - rust-lang#119386 (fix typo in `IpAddr::to_canonical`) - rust-lang#119413 (solaris support on bootstrap lock) - rust-lang#119424 (Primitive docs: fix confusing `Send` in `&T`'s list) - rust-lang#119425 (Fix invalid check-cfg Cargo feature diagnostic help) r? `@ghost` `@rustbot` modify labels: rollup
2 parents c2354aa + e930ea2 commit d59f06f

File tree

10 files changed

+101
-93
lines changed

10 files changed

+101
-93
lines changed

compiler/rustc_lint/src/context.rs

-2
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,6 @@ pub trait LintContext {
804804
db.span_suggestion(value_span, "there is a expected value with a similar name", format!("\"{best_match}\""), Applicability::MaybeIncorrect);
805805

806806
}
807-
} else if name == sym::feature && is_from_cargo {
808-
db.help(format!("consider defining `{name}` as feature in `Cargo.toml`"));
809807
} else if let &[first_possibility] = &possibilities[..] {
810808
db.span_suggestion(name_span.shrink_to_hi(), "specify a config value", format!(" = \"{first_possibility}\""), Applicability::MaybeIncorrect);
811809
}

library/alloc/src/sync.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -2917,20 +2917,17 @@ impl<T: ?Sized, A: Allocator + Clone> Clone for Weak<T, A> {
29172917
/// ```
29182918
#[inline]
29192919
fn clone(&self) -> Weak<T, A> {
2920-
let inner = if let Some(inner) = self.inner() {
2921-
inner
2922-
} else {
2923-
return Weak { ptr: self.ptr, alloc: self.alloc.clone() };
2924-
};
2925-
// See comments in Arc::clone() for why this is relaxed. This can use a
2926-
// fetch_add (ignoring the lock) because the weak count is only locked
2927-
// where are *no other* weak pointers in existence. (So we can't be
2928-
// running this code in that case).
2929-
let old_size = inner.weak.fetch_add(1, Relaxed);
2930-
2931-
// See comments in Arc::clone() for why we do this (for mem::forget).
2932-
if old_size > MAX_REFCOUNT {
2933-
abort();
2920+
if let Some(inner) = self.inner() {
2921+
// See comments in Arc::clone() for why this is relaxed. This can use a
2922+
// fetch_add (ignoring the lock) because the weak count is only locked
2923+
// where are *no other* weak pointers in existence. (So we can't be
2924+
// running this code in that case).
2925+
let old_size = inner.weak.fetch_add(1, Relaxed);
2926+
2927+
// See comments in Arc::clone() for why we do this (for mem::forget).
2928+
if old_size > MAX_REFCOUNT {
2929+
abort();
2930+
}
29342931
}
29352932

29362933
Weak { ptr: self.ptr, alloc: self.alloc.clone() }

library/core/src/net/ip_addr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl IpAddr {
407407
}
408408

409409
/// Converts this address to an `IpAddr::V4` if it is an IPv4-mapped IPv6 addresses, otherwise it
410-
/// return `self` as-is.
410+
/// returns `self` as-is.
411411
///
412412
/// # Examples
413413
///

library/core/src/primitive_docs.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,6 @@ mod prim_usize {}
13481348
/// * [`Fn`] \(in addition, `&T` references get [`FnMut`] and [`FnOnce`] if `T: Fn`)
13491349
/// * [`Hash`]
13501350
/// * [`ToSocketAddrs`]
1351-
/// * [`Send`] \(`&T` references also require <code>T: [Sync]</code>)
13521351
/// * [`Sync`]
13531352
///
13541353
/// [`std::fmt`]: fmt
@@ -1366,6 +1365,7 @@ mod prim_usize {}
13661365
/// * [`ExactSizeIterator`]
13671366
/// * [`FusedIterator`]
13681367
/// * [`TrustedLen`]
1368+
/// * [`Send`]
13691369
/// * [`io::Write`]
13701370
/// * [`Read`]
13711371
/// * [`Seek`]
@@ -1378,6 +1378,8 @@ mod prim_usize {}
13781378
/// [`Read`]: ../std/io/trait.Read.html
13791379
/// [`io::Write`]: ../std/io/trait.Write.html
13801380
///
1381+
/// In addition, `&T` references implement [`Send`] if and only if `T` implements [`Sync`].
1382+
///
13811383
/// Note that due to method call deref coercion, simply calling a trait method will act like they
13821384
/// work on references as well as they do on owned values! The implementations described here are
13831385
/// meant for generic contexts, where the final type `T` is a type parameter or otherwise not

src/bootstrap/Cargo.lock

+32-32
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,19 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
246246

247247
[[package]]
248248
name = "errno"
249-
version = "0.3.5"
249+
version = "0.3.8"
250250
source = "registry+https://github.com/rust-lang/crates.io-index"
251-
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
251+
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
252252
dependencies = [
253253
"libc",
254254
"windows-sys",
255255
]
256256

257257
[[package]]
258258
name = "fd-lock"
259-
version = "3.0.13"
259+
version = "4.0.2"
260260
source = "registry+https://github.com/rust-lang/crates.io-index"
261-
checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5"
261+
checksum = "7e5768da2206272c81ef0b5e951a41862938a6070da63bcea197899942d3b947"
262262
dependencies = [
263263
"cfg-if",
264264
"rustix",
@@ -369,9 +369,9 @@ checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
369369

370370
[[package]]
371371
name = "linux-raw-sys"
372-
version = "0.4.10"
372+
version = "0.4.12"
373373
source = "registry+https://github.com/rust-lang/crates.io-index"
374-
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
374+
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
375375

376376
[[package]]
377377
name = "log"
@@ -530,9 +530,9 @@ checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
530530

531531
[[package]]
532532
name = "rustix"
533-
version = "0.38.19"
533+
version = "0.38.28"
534534
source = "registry+https://github.com/rust-lang/crates.io-index"
535-
checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed"
535+
checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
536536
dependencies = [
537537
"bitflags 2.4.1",
538538
"errno",
@@ -620,9 +620,9 @@ dependencies = [
620620

621621
[[package]]
622622
name = "sysinfo"
623-
version = "0.30.1"
623+
version = "0.30.3"
624624
source = "registry+https://github.com/rust-lang/crates.io-index"
625-
checksum = "01e979b637815805abbdeea72e4b6d9374dd0efce6524cc65c31e14911dbc671"
625+
checksum = "ba2dbd2894d23b2d78dae768d85e323b557ac3ac71a5d917a31536d8f77ebada"
626626
dependencies = [
627627
"cfg-if",
628628
"core-foundation-sys",
@@ -733,37 +733,37 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
733733

734734
[[package]]
735735
name = "windows"
736-
version = "0.51.1"
736+
version = "0.52.0"
737737
source = "registry+https://github.com/rust-lang/crates.io-index"
738-
checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9"
738+
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
739739
dependencies = [
740740
"windows-core",
741741
"windows-targets",
742742
]
743743

744744
[[package]]
745745
name = "windows-core"
746-
version = "0.51.1"
746+
version = "0.52.0"
747747
source = "registry+https://github.com/rust-lang/crates.io-index"
748-
checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
748+
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
749749
dependencies = [
750750
"windows-targets",
751751
]
752752

753753
[[package]]
754754
name = "windows-sys"
755-
version = "0.48.0"
755+
version = "0.52.0"
756756
source = "registry+https://github.com/rust-lang/crates.io-index"
757-
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
757+
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
758758
dependencies = [
759759
"windows-targets",
760760
]
761761

762762
[[package]]
763763
name = "windows-targets"
764-
version = "0.48.5"
764+
version = "0.52.0"
765765
source = "registry+https://github.com/rust-lang/crates.io-index"
766-
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
766+
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
767767
dependencies = [
768768
"windows_aarch64_gnullvm",
769769
"windows_aarch64_msvc",
@@ -776,45 +776,45 @@ dependencies = [
776776

777777
[[package]]
778778
name = "windows_aarch64_gnullvm"
779-
version = "0.48.5"
779+
version = "0.52.0"
780780
source = "registry+https://github.com/rust-lang/crates.io-index"
781-
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
781+
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
782782

783783
[[package]]
784784
name = "windows_aarch64_msvc"
785-
version = "0.48.5"
785+
version = "0.52.0"
786786
source = "registry+https://github.com/rust-lang/crates.io-index"
787-
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
787+
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
788788

789789
[[package]]
790790
name = "windows_i686_gnu"
791-
version = "0.48.5"
791+
version = "0.52.0"
792792
source = "registry+https://github.com/rust-lang/crates.io-index"
793-
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
793+
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
794794

795795
[[package]]
796796
name = "windows_i686_msvc"
797-
version = "0.48.5"
797+
version = "0.52.0"
798798
source = "registry+https://github.com/rust-lang/crates.io-index"
799-
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
799+
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
800800

801801
[[package]]
802802
name = "windows_x86_64_gnu"
803-
version = "0.48.5"
803+
version = "0.52.0"
804804
source = "registry+https://github.com/rust-lang/crates.io-index"
805-
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
805+
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
806806

807807
[[package]]
808808
name = "windows_x86_64_gnullvm"
809-
version = "0.48.5"
809+
version = "0.52.0"
810810
source = "registry+https://github.com/rust-lang/crates.io-index"
811-
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
811+
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
812812

813813
[[package]]
814814
name = "windows_x86_64_msvc"
815-
version = "0.48.5"
815+
version = "0.52.0"
816816
source = "registry+https://github.com/rust-lang/crates.io-index"
817-
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
817+
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
818818

819819
[[package]]
820820
name = "xattr"

src/bootstrap/Cargo.toml

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cc = "1.0.69"
3838
clap = { version = "4.4.7", default-features = false, features = ["std", "usage", "help", "derive", "error-context"] }
3939
clap_complete = "4.4.3"
4040
cmake = "0.1.38"
41+
fd-lock = "4.0"
4142
filetime = "0.2"
4243
home = "0.5.4"
4344
ignore = "0.4.10"
@@ -61,15 +62,11 @@ xz2 = "0.1"
6162
# Dependencies needed by the build-metrics feature
6263
sysinfo = { version = "0.30", optional = true }
6364

64-
# Solaris doesn't support flock() and thus fd-lock is not option now
65-
[target.'cfg(not(target_os = "solaris"))'.dependencies]
66-
fd-lock = "3.0.13"
67-
6865
[target.'cfg(windows)'.dependencies.junction]
6966
version = "1.0.0"
7067

7168
[target.'cfg(windows)'.dependencies.windows]
72-
version = "0.51.1"
69+
version = "0.52"
7370
features = [
7471
"Win32_Foundation",
7572
"Win32_Security",

src/bootstrap/src/bin/main.rs

+23-32
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//! directory in each respective module.
77
88
use std::io::Write;
9-
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
109
use std::process;
1110
use std::{
1211
env,
@@ -22,43 +21,35 @@ fn main() {
2221
let args = env::args().skip(1).collect::<Vec<_>>();
2322
let config = Config::parse(&args);
2423

25-
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
2624
let mut build_lock;
27-
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
2825
let _build_lock_guard;
2926

3027
if !config.bypass_bootstrap_lock {
3128
// Display PID of process holding the lock
3229
// PID will be stored in a lock file
33-
#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
34-
{
35-
let path = config.out.join("lock");
36-
let pid = match fs::read_to_string(&path) {
37-
Ok(contents) => contents,
38-
Err(_) => String::new(),
39-
};
40-
41-
build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
42-
.write(true)
43-
.create(true)
44-
.open(&path)));
45-
_build_lock_guard = match build_lock.try_write() {
46-
Ok(mut lock) => {
47-
t!(lock.write(&process::id().to_string().as_ref()));
48-
lock
49-
}
50-
err => {
51-
drop(err);
52-
println!("WARNING: build directory locked by process {pid}, waiting for lock");
53-
let mut lock = t!(build_lock.write());
54-
t!(lock.write(&process::id().to_string().as_ref()));
55-
lock
56-
}
57-
};
58-
}
59-
60-
#[cfg(any(not(any(unix, windows)), target_os = "solaris"))]
61-
println!("WARNING: file locking not supported for target, not locking build directory");
30+
let lock_path = config.out.join("lock");
31+
let pid = match fs::read_to_string(&lock_path) {
32+
Ok(contents) => contents,
33+
Err(_) => String::new(),
34+
};
35+
36+
build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
37+
.write(true)
38+
.create(true)
39+
.open(&lock_path)));
40+
_build_lock_guard = match build_lock.try_write() {
41+
Ok(mut lock) => {
42+
t!(lock.write(&process::id().to_string().as_ref()));
43+
lock
44+
}
45+
err => {
46+
drop(err);
47+
println!("WARNING: build directory locked by process {pid}, waiting for lock");
48+
let mut lock = t!(build_lock.write());
49+
t!(lock.write(&process::id().to_string().as_ref()));
50+
lock
51+
}
52+
};
6253
}
6354

6455
// check_version warnings are not printed during setup

tests/ui/check-cfg/cargo-feature.none.stderr

+12-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@ LL | #[cfg(feature = "serde")]
88
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
99
= note: `#[warn(unexpected_cfgs)]` on by default
1010

11-
warning: unexpected `cfg` condition name: `tokio_unstable`
11+
warning: unexpected `cfg` condition name: `feature`
1212
--> $DIR/cargo-feature.rs:18:7
1313
|
14+
LL | #[cfg(feature)]
15+
| ^^^^^^^
16+
|
17+
= help: consider defining some features in `Cargo.toml`
18+
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
19+
20+
warning: unexpected `cfg` condition name: `tokio_unstable`
21+
--> $DIR/cargo-feature.rs:23:7
22+
|
1423
LL | #[cfg(tokio_unstable)]
1524
| ^^^^^^^^^^^^^^
1625
|
@@ -19,13 +28,13 @@ LL | #[cfg(tokio_unstable)]
1928
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
2029

2130
warning: unexpected `cfg` condition name: `CONFIG_NVME`
22-
--> $DIR/cargo-feature.rs:22:7
31+
--> $DIR/cargo-feature.rs:27:7
2332
|
2433
LL | #[cfg(CONFIG_NVME = "m")]
2534
| ^^^^^^^^^^^^^^^^^
2635
|
2736
= help: consider using a Cargo feature instead or adding `println!("cargo:rustc-check-cfg=cfg(CONFIG_NVME, values(\"m\"))");` to the top of a `build.rs`
2837
= note: see <https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg> for more information about checking conditional configuration
2938

30-
warning: 3 warnings emitted
39+
warning: 4 warnings emitted
3140

tests/ui/check-cfg/cargo-feature.rs

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
//[some]~^^ WARNING unexpected `cfg` condition value
1616
fn ser() {}
1717

18+
#[cfg(feature)]
19+
//[none]~^ WARNING unexpected `cfg` condition name
20+
//[some]~^^ WARNING unexpected `cfg` condition value
21+
fn feat() {}
22+
1823
#[cfg(tokio_unstable)]
1924
//~^ WARNING unexpected `cfg` condition name
2025
fn tokio() {}

0 commit comments

Comments
 (0)