# Pre-RFC: stabilization of target\_feature

**URL:** <https://internals.rust-lang.org/t/pre-rfc-stabilization-of-target-feature/5176>\
**Category:** compiler\
**Created:** [May 4, 2017, 9:57am UTC](https://internals.rust-lang.org/t/pre-rfc-stabilization-of-target-feature/5176 "2017-05-04T09:57:40Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![est31](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/est31/32/2551_2.png) [@est31](https://internals.rust-lang.org/u/est31)\
**Post date:** [June 20, 2017, 9:40am UTC](https://internals.rust-lang.org/t/pre-rfc-stabilization-of-target-feature/5176/34 "2017-06-20T09:40:29Z")

</div>

> [@gnzlbg](#):
>
> one of the most important uses of #[target\_feature] is the ability to provide a binary with code for different target features, that selects the right code path at run-time

Yeah, thats a very good point in fact, that, I admit, makes most of the recent discussion moot. If we wanted static guarantees, we could just decide to not add the `target_feature` flag and instead force users to use the less powerful `cfg(target_feature)`. Additionally, there seems to be already RFC 1868 which covers the topic lengthy, no need to re-invent the wheel here, although I guess as its a new feature we could be more strict with it. But let's not do it. I drop my demand to have such a way of checking 🙂 .

I was suggesting this change because I think that `target_feature` in its current form too unsafe for Rust which praises itself as "safe" language. All I _want_ basically is that there should be no way to call a `target_feature` function from safe code and it SIGILLS, except some unsafe code that's outside of the language has made a mistake.

So my next proposal is very simple: just require every `target_feature` function to be an unsafe fn, and then external crates can come up with (proc) macros to call such a function and dispatch on it based on various criteria, from safe code.

---

_[View the full topic](https://internals.rust-lang.org/t/pre-rfc-stabilization-of-target-feature/5176)._
