# Raise a compile warning if you use an x86 intrinsic that's not supported by the target\_feature

**URL:** <https://internals.rust-lang.org/t/raise-a-compile-warning-if-you-use-an-x86-intrinsic-thats-not-supported-by-the-target-feature/21274>\
**Category:** Uncategorized\
**Created:** [July 29, 2024, 12:11am UTC](https://internals.rust-lang.org/t/raise-a-compile-warning-if-you-use-an-x86-intrinsic-thats-not-supported-by-the-target-feature/21274 "2024-07-29T00:11:16Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![newpavlov](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/newpavlov/32/3290_2.png) [@newpavlov](https://internals.rust-lang.org/u/newpavlov)\
**Post date:** [July 29, 2024, 8:53am UTC](https://internals.rust-lang.org/t/raise-a-compile-warning-if-you-use-an-x86-intrinsic-thats-not-supported-by-the-target-feature/21274/3 "2024-07-29T08:53:24Z")

</div>

Yeah, the current handling of target features is disappointingly "not Rusty" (i.e. instead of proper compile-time checks we have `unsafe` everywhere). Long time ago I wrote the following proposal, but unfortunately amount of development activity in this area is very small:

> [@\[Pre-Pre-RFC\] Target restriction contexts](https://internals.rust-lang.org/t/7163):
>
> The following text is braindump-like description of how I would like to see Rust work with various target options. (target\_arch, target\_feature, target\_os and [others](https://doc.rust-lang.org/reference/attributes.html#conditional-compilation)) This approach aims to provide stronger compile time guarantees compared to current cfg setups, remove most of the unsafe in the [stdsimd](https://github.com/rust-lang-nursery/stdsimd) crate and integrate target parameters closer with Cargo.toml. Also it could be useful for improving Rust [portability story](https://internals.rust-lang.org/t/a-vision-for-portability-in-rust/6719). While [RFC 2045](https://github.com/rust-lang/rfcs/pull/2045) is an important step towards [stabilization](https://github.com/rust-lang/rust/issues/48556) of SIMD, I don…

---

_[View the full topic](https://internals.rust-lang.org/t/raise-a-compile-warning-if-you-use-an-x86-intrinsic-thats-not-supported-by-the-target-feature/21274)._
