Skip to content

Commit

Permalink
Auto merge of #132145 - RalfJung:stdarch, r=Amanieu
Browse files Browse the repository at this point in the history
bump stdarch

This lets us remove a hack from #131349.

r? `@Amanieu`

try-job: test-various
  • Loading branch information
bors committed Oct 28, 2024
2 parents 9f57edf + d066dfd commit 3f1be1e
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 14 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_error_codes/src/error_codes/E0539.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const fn unstable_fn() {}
#[stable(feature = "stable_struct", since = "1.39.0")] // ok!
struct Stable;
#[stable(feature = "stable_fn", since = "1.39.0")]
#[rustc_const_stable(feature = "stable_fn", since = "1.39.0")] // ok!
const fn stable_fn() {}
```
1 change: 1 addition & 0 deletions compiler/rustc_error_codes/src/error_codes/E0542.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ To fix this issue, you need to provide the `since` field. Example:
#[stable(feature = "_stable_fn", since = "1.0.0")] // ok!
fn _stable_fn() {}
#[stable(feature = "_stable_const_fn", since = "1.0.0")]
#[rustc_const_stable(feature = "_stable_const_fn", since = "1.0.0")] // ok!
const fn _stable_const_fn() {}
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_passes/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
&& let Some(fn_sig) = fn_sig
&& const_stab.is_const_stable()
&& !stab.is_some_and(|(s, _)| s.is_stable())
// FIXME: we skip this check targets until
// <https://github.com/rust-lang/stdarch/pull/1654> propagates.
&& false
{
self.tcx
.dcx()
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/sync/condvar/no_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub struct Condvar {}

impl Condvar {
#[inline]
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_locks", since = "1.63.0"))]
pub const fn new() -> Condvar {
Condvar {}
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/sync/mutex/no_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ unsafe impl Sync for Mutex {} // no threads on this platform

impl Mutex {
#[inline]
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_locks", since = "1.63.0"))]
pub const fn new() -> Mutex {
Mutex { locked: Cell::new(false) }
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/sync/once/no_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ unsafe impl Sync for Once {}

impl Once {
#[inline]
#[rustc_const_stable(feature = "const_once_new", since = "1.32.0")]
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_once_new", since = "1.32.0"))]
pub const fn new() -> Once {
Once { state: Cell::new(State::Incomplete) }
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/sync/rwlock/no_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ unsafe impl Sync for RwLock {} // no threads on this platform

impl RwLock {
#[inline]
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_locks", since = "1.63.0"))]
pub const fn new() -> RwLock {
RwLock { mode: Cell::new(0) }
}
Expand Down
2 changes: 1 addition & 1 deletion library/stdarch
Submodule stdarch updated 49 files
+0 −1 .github/workflows/main.yml
+2 −10 Cargo.toml
+3 −3 ci/docker/x86_64-unknown-linux-gnu-emulated/Dockerfile
+2 −2 ci/docker/x86_64-unknown-linux-gnu-emulated/cpuid.def
+8 −0 crates/core_arch/Cargo.toml
+0 −3 crates/core_arch/build.rs
+6 −34 crates/core_arch/src/arm_shared/crc.rs
+2 −2 crates/core_arch/src/core_arch_docs.md
+2 −1 crates/core_arch/src/lib.rs
+42 −6 crates/core_arch/src/loongarch64/lasx/generated.rs
+68 −0 crates/core_arch/src/loongarch64/lasx/tests.rs
+42 −6 crates/core_arch/src/loongarch64/lsx/generated.rs
+32 −0 crates/core_arch/src/loongarch64/lsx/tests.rs
+1 −2 crates/core_arch/src/simd.rs
+0 −1 crates/core_arch/src/wasm32/simd128.rs
+2 −2 crates/core_arch/src/x86/abm.rs
+3 −3 crates/core_arch/src/x86/avx.rs
+300 −300 crates/core_arch/src/x86/avx512dq.rs
+1,145 −1,145 crates/core_arch/src/x86/avx512f.rs
+1,015 −1,015 crates/core_arch/src/x86/avx512fp16.rs
+171 −380 crates/core_arch/src/x86/avx512vbmi2.rs
+10 −10 crates/core_arch/src/x86/f16c.rs
+21 −21 crates/core_arch/src/x86/sse.rs
+22 −98 crates/core_arch/src/x86/sse41.rs
+5 −14 crates/core_arch/src/x86/xsave.rs
+2 −2 crates/core_arch/src/x86_64/abm.rs
+3 −3 crates/core_arch/src/x86_64/avx.rs
+60 −60 crates/core_arch/src/x86_64/avx512f.rs
+20 −20 crates/core_arch/src/x86_64/avx512fp16.rs
+6 −15 crates/core_arch/src/x86_64/xsave.rs
+1 −7 crates/intrinsic-test/src/format.rs
+1 −1 crates/intrinsic-test/src/main.rs
+4 −4 crates/intrinsic-test/src/types.rs
+1 −1 crates/intrinsic-test/src/values.rs
+3 −0 crates/std_detect/src/detect/arch/aarch64.rs
+1 −1 crates/std_detect/src/detect/cache.rs
+4 −0 crates/std_detect/src/detect/os/linux/aarch64.rs
+1 −0 crates/std_detect/tests/cpu-detection.rs
+88 −122 crates/stdarch-gen-arm/src/main.rs
+4 −2 crates/stdarch-gen-loongarch/README.md
+20 −0 crates/stdarch-gen-loongarch/lasx.spec
+36 −2 crates/stdarch-gen-loongarch/lasxintrin.h
+20 −0 crates/stdarch-gen-loongarch/lsx.spec
+36 −2 crates/stdarch-gen-loongarch/lsxintrin.h
+21 −13 crates/stdarch-gen-loongarch/src/main.rs
+1 −1 crates/stdarch-test/src/disassembly.rs
+1 −4 crates/stdarch-test/src/lib.rs
+1 −1 crates/stdarch-verify/src/lib.rs
+15 −42 examples/connect5.rs
5 changes: 2 additions & 3 deletions tests/ui/consts/rustc-const-stability-require-const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,15 @@ pub const fn foobar() {}
pub const fn barfoo() {}

// `rustc_const_stable` also requires the function to be stable.
// FIXME: these are disabled until <https://github.com/rust-lang/stdarch/pull/1654> propagates.

#[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
const fn barfoo_unmarked() {}
// FIXME disabled ERROR can only be applied to functions that are declared `#[stable]`
//~^ ERROR can only be applied to functions that are declared `#[stable]`

#[unstable(feature = "unstable", issue = "none")]
#[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
pub const fn barfoo_unstable() {}
// FIXME disabled ERROR can only be applied to functions that are declared `#[stable]`
//~^ ERROR can only be applied to functions that are declared `#[stable]`

// `#[rustc_const_stable_indirect]` also requires a const fn
#[rustc_const_stable_indirect]
Expand Down
22 changes: 19 additions & 3 deletions tests/ui/consts/rustc-const-stability-require-const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,33 @@ help: make the function or method const
LL | pub extern "C" fn foo_c() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`
--> $DIR/rustc-const-stability-require-const.rs:52:1
|
LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
| ---------------------------------------------------------------- attribute specified here
LL | const fn barfoo_unmarked() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`
--> $DIR/rustc-const-stability-require-const.rs:57:1
|
LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
| ---------------------------------------------------------------- attribute specified here
LL | pub const fn barfoo_unstable() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const`
--> $DIR/rustc-const-stability-require-const.rs:64:1
--> $DIR/rustc-const-stability-require-const.rs:63:1
|
LL | pub fn not_a_const_fn() {}
| ^^^^^^^^^^^^^^^^^^^^^^^
|
help: make the function or method const
--> $DIR/rustc-const-stability-require-const.rs:64:1
--> $DIR/rustc-const-stability-require-const.rs:63:1
|
LL | pub fn not_a_const_fn() {}
| ^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 7 previous errors
error: aborting due to 9 previous errors

0 comments on commit 3f1be1e

Please sign in to comment.