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/`](
|
||
---|---|---|
.. | ||
aarch64 | ||
x86_64 | ||
bad-arch.mirunsafeck.stderr | ||
bad-arch.rs | ||
bad-arch.thirunsafeck.stderr | ||
bad-template.aarch64_mirunsafeck.stderr | ||
bad-template.aarch64_thirunsafeck.stderr | ||
bad-template.rs | ||
bad-template.x86_64_mirunsafeck.stderr | ||
bad-template.x86_64_thirunsafeck.stderr | ||
generic-const.rs | ||
inline-syntax.arm.stderr | ||
inline-syntax.rs | ||
inline-syntax.x86_64.stderr | ||
issue-72570.rs | ||
issue-72570.stderr | ||
issue-85247.rs | ||
issue-85247.rwpi.stderr | ||
issue-87802.rs | ||
issue-87802.stderr | ||
issue-89305.rs | ||
issue-89305.stderr | ||
issue-92378.rs | ||
issue-97490.rs | ||
issue-99071.rs | ||
issue-99071.stderr | ||
issue-99122-2.rs | ||
issue-99122.rs | ||
issue-99122.stderr | ||
may_unwind.rs | ||
naked-functions-ffi.rs | ||
naked-functions-ffi.stderr | ||
naked-functions-unused.aarch64.stderr | ||
naked-functions-unused.rs | ||
naked-functions-unused.x86_64.stderr | ||
naked-functions.rs | ||
naked-functions.stderr | ||
naked-invalid-attr.rs | ||
naked-invalid-attr.stderr | ||
named-asm-labels.rs | ||
named-asm-labels.s | ||
named-asm-labels.stderr | ||
noreturn.rs | ||
reg-conflict.rs | ||
reg-conflict.stderr | ||
type-check-1.rs | ||
type-check-1.stderr | ||
type-check-4.rs | ||
type-check-4.stderr | ||
unpretty-expanded.rs | ||
unpretty-expanded.stdout |