#5294·miri

Communicate the actually supported target features to the program

Author: RalfJungCreated Aug 28, 2026Updated Sep 4, 2026
LabelsC-proposalA-interpreter

The std is_*_feature_detected! macro currently just reports whatever target features are enabled via -C (or by default in the target), without regard for what Miri actually supports. The same goes for user crates with similar functionality, such as cpufeatures.

Maybe we should have a way for a crate to ask Miri whether a given target feature is supported? We'll eventually need this anyway for https://github.com/rust-lang/miri/issues/3100, but it turns out this may be useful even earlier. See the discussion in https://github.com/RustCrypto/utils/pull/1513. If Miri could tell cpufeatures that x86.avx2 is fine but aarch64.aes is not, that would avoid the need for patches like https://github.com/RustCrypto/block-ciphers/pull/586.

That said, the std macro currently promises (?) that features available via cfg(target_feature) are also available via is_*_feature_detected! so it may be problematic to return false for features that are supposedly enabled but not supported by Miri. OTOH maybe that's less problematic than the status quo?

@Amanieu @newpavlov I wonder what your thoughts on this are.