Description
I tried this code:
use std::arch::x86_64::*;
fn main() {
unsafe { ud2(); }
}
I expected this code to successfully compile on stable
, since all of std::arch
, core::arch
, core_arch::arch
and core_arch::arch::x86/x86_64
are explicitly marked stable since 1.27
:
#[doc = include_str!("core_arch_docs.md")]
#[stable(feature = "simd_arch", since = "1.27.0")]
pub mod arch {
/// Platform-specific intrinsics for the `x86` platform.
///
/// See the [module documentation](../index.html) for more details.
#[cfg(any(target_arch = "x86", doc))]
#[doc(cfg(target_arch = "x86"))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub mod x86 {
#[stable(feature = "simd_x86", since = "1.27.0")]
pub use crate::core_arch::x86::*;
}
/// Platform-specific intrinsics for the `x86_64` platform.
///
/// See the [module documentation](../index.html) for more details.
#[cfg(any(target_arch = "x86_64", doc))]
#[doc(cfg(target_arch = "x86_64"))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub mod x86_64 {
#[stable(feature = "simd_x86", since = "1.27.0")]
pub use crate::core_arch::x86::*;
#[stable(feature = "simd_x86", since = "1.27.0")]
pub use crate::core_arch::x86_64::*;
}
/* snip */
}
Instead, I got the error
error[E0658]: use of unstable library feature 'stdsimd'
--> src\main.rs:4:14
|
4 | unsafe { ud2(); }
| ^^^
|
= note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information
= help: add `#![feature(stdsimd)]` to the crate attributes to enable
However, this issue is closed, since x86/x86_64/aarch64 intrinsics were shipped long ago:
We discussed this in today's @rust-lang/lang meeting.
This seems to be the tracking issue for target-specific SIMD (not portable SIMD, which is being tracked and developed elsewhere). And we've shipped target-specific SIMD on x86-64 and aarch64. There will always be more CPUs to support, but that doesn't mean this issue needs to remain open indefinitely.
We've shipped this; closing.
The stdsimd feature flag was also removed from all x86/x86_64 intrinsics a long time ago. However, I can see that the core_arch
crate is included as an unstable submodule guarded by #[feature(stdsimd)]
inside of libcore:
// Pull in the `core_arch` crate directly into libcore. The contents of
// `core_arch` are in a different repository: rust-lang/stdarch.
//
// `core_arch` depends on libcore, but the contents of this module are
// set up in such a way that directly pulling it here works such that the
// crate uses the this crate as its libcore.
#[path = "../../stdarch/crates/core_arch/src/mod.rs"]
#[allow(
missing_docs,
missing_debug_implementations,
dead_code,
unused_imports,
unsafe_op_in_unsafe_fn
)]
#[allow(rustdoc::bare_urls)]
// FIXME: This annotation should be moved into rust-lang/stdarch after clashing_extern_declarations is
// merged. It currently cannot because bootstrap fails as the lint hasn't been defined yet.
#[allow(clashing_extern_declarations)]
#[unstable(feature = "stdsimd", issue = "48556")]
mod core_arch;
Rust version
This issue reproduces on the current stable and nightly toolchains.
rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-pc-windows-msvc
release: 1.61.0
LLVM version: 14.0.0
rustc 1.63.0-nightly (4e725bad7 2022-06-04)
binary: rustc
commit-hash: 4e725bad73747a4c93a3ac53106e4b4006edc665
commit-date: 2022-06-04
host: x86_64-pc-windows-msvc
release: 1.63.0-nightly
LLVM version: 14.0.5