b583ede652
Stabilize `#![feature(target_feature_11)]`
## Stabilization report
### Summary
Allows for safe functions to be marked with `#[target_feature]` attributes.
Functions marked with `#[target_feature]` are generally considered as unsafe functions: they are unsafe to call, cannot be assigned to safe function pointers, and don't implement the `Fn*` traits.
However, calling them from other `#[target_feature]` functions with a superset of features is safe.
```rust
// Demonstration function
#[target_feature(enable = "avx2")]
fn avx2() {}
fn foo() {
// Calling `avx2` here is unsafe, as we must ensure
// that AVX is available first.
unsafe {
avx2();
}
}
#[target_feature(enable = "avx2")]
fn bar() {
// Calling `avx2` here is safe.
avx2();
}
```
### Test cases
Tests for this feature can be found in [`src/test/ui/rfcs/rfc-2396-target_feature-11/`](
|
||
---|---|---|
.. | ||
alloc | ||
array | ||
async_iter | ||
cell | ||
char | ||
convert | ||
ffi | ||
fmt | ||
future | ||
hash | ||
intrinsics | ||
iter | ||
macros | ||
mem | ||
net | ||
num | ||
ops | ||
panic | ||
prelude | ||
ptr | ||
slice | ||
str | ||
sync | ||
task | ||
unicode | ||
any.rs | ||
arch.rs | ||
ascii.rs | ||
asserting.rs | ||
bool.rs | ||
borrow.rs | ||
cell.rs | ||
clone.rs | ||
cmp.rs | ||
default.rs | ||
error.md | ||
error.rs | ||
hint.rs | ||
internal_macros.rs | ||
intrinsics.rs | ||
lib.rs | ||
marker.rs | ||
option.rs | ||
panic.rs | ||
panicking.rs | ||
pin.rs | ||
primitive_docs.rs | ||
primitive.rs | ||
result.rs | ||
time.rs | ||
tuple.rs | ||
unit.rs |