-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed
Labels
A-miriArea: The miri toolArea: The miri toolA-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.Area: Enabling/disabling target features like AVX, Neon, etc.C-bugCategory: This is a bug.Category: This is a bug.
Description
I tried this code:
fn main() {
dbg!(cfg!(target_feature = "avx2"));
}RUSTFLAGS="-Ctarget-cpu=x86-64-v3" cargo miri runI expected to see this happen:
[src/main.rs:2:5] cfg!(target_feature = "avx2") = true
Instead, this happened:
[src/main.rs:2:5] cfg!(target_feature = "avx2") = false
If -Ctarget-feature is used:
RUSTFLAGS="-Ctarget-feature=+avx2" cargo miri run[src/main.rs:2:5] cfg!(target_feature = "avx2") = true
If -Zcodegen-backend=llvm is used:
RUSTFLAGS="-Ctarget-cpu=x86-64-v3 -Zcodegen-backend=llvm" cargo miri run[src/main.rs:2:5] cfg!(target_feature = "avx2") = true
Meta
rustc 1.93.0-nightly (6647be936 2025-11-09)
binary: rustc
commit-hash: 6647be93640686a2a443a49f15c3390b68c8b5dd
commit-date: 2025-11-09
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.3
nightly-2025-11-09 works but nightly-2025-11-10 doesn't. So probably it's caused by #148734.
Metadata
Metadata
Assignees
Labels
A-miriArea: The miri toolArea: The miri toolA-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.Area: Enabling/disabling target features like AVX, Neon, etc.C-bugCategory: This is a bug.Category: This is a bug.