1
Fork 0

Stabilize #![feature(target_feature_11)]

This commit is contained in:
Léo Lanteri Thauvin 2022-07-23 14:32:52 +02:00
parent 0d32c8f2ce
commit b379d216ee
28 changed files with 78 additions and 151 deletions

View file

@ -11,8 +11,6 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(target_feature_11)]
#[target_feature(enable = "sse2")]
const fn sse2() {}

View file

@ -5,8 +5,6 @@
// [thir]compile-flags: -Z thir-unsafeck
// only-x86_64
#![feature(target_feature_11)]
#[target_feature(enable="avx")]
fn also_use_avx() {
println!("Hello from AVX")

View file

@ -1,6 +0,0 @@
// only-x86_64
#[target_feature(enable = "sse2")] //~ ERROR can only be applied to `unsafe` functions
fn foo() {}
fn main() {}

View file

@ -1,14 +0,0 @@
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
--> $DIR/feature-gate-target_feature_11.rs:3:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | fn foo() {}
| -------- not an `unsafe` function
|
= note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
= help: add `#![feature(target_feature_11)]` to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/fn-ptr.rs:11:21
--> $DIR/fn-ptr.rs:9:21
|
LL | #[target_feature(enable = "sse2")]
| ---------------------------------- `#[target_feature]` added here

View file

@ -2,8 +2,6 @@
// [thir]compile-flags: -Z thir-unsafeck
// only-x86_64
#![feature(target_feature_11)]
#[target_feature(enable = "sse2")]
fn foo() {}

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/fn-ptr.rs:11:21
--> $DIR/fn-ptr.rs:9:21
|
LL | #[target_feature(enable = "sse2")]
| ---------------------------------- `#[target_feature]` added here

View file

@ -1,7 +1,5 @@
// only-x86_64
#![feature(target_feature_11)]
#[target_feature(enable = "avx")]
fn foo() {}

View file

@ -1,5 +1,5 @@
error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:24:10
--> $DIR/fn-traits.rs:22:10
|
LL | call(foo);
| ---- ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
@ -10,13 +10,13 @@ LL | call(foo);
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call`
--> $DIR/fn-traits.rs:11:17
--> $DIR/fn-traits.rs:9:17
|
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:25:14
--> $DIR/fn-traits.rs:23:14
|
LL | call_mut(foo);
| -------- ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
@ -27,13 +27,13 @@ LL | call_mut(foo);
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_mut`
--> $DIR/fn-traits.rs:15:21
--> $DIR/fn-traits.rs:13:21
|
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}`
--> $DIR/fn-traits.rs:26:15
--> $DIR/fn-traits.rs:24:15
|
LL | call_once(foo);
| --------- ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
@ -44,13 +44,13 @@ LL | call_once(foo);
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_once`
--> $DIR/fn-traits.rs:19:22
--> $DIR/fn-traits.rs:17:22
|
LL | fn call_once(f: impl FnOnce()) {
| ^^^^^^^^ required by this bound in `call_once`
error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:28:10
--> $DIR/fn-traits.rs:26:10
|
LL | call(foo_unsafe);
| ---- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@ -61,13 +61,13 @@ LL | call(foo_unsafe);
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call`
--> $DIR/fn-traits.rs:11:17
--> $DIR/fn-traits.rs:9:17
|
LL | fn call(f: impl Fn()) {
| ^^^^ required by this bound in `call`
error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:30:14
--> $DIR/fn-traits.rs:28:14
|
LL | call_mut(foo_unsafe);
| -------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@ -78,13 +78,13 @@ LL | call_mut(foo_unsafe);
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_mut`
--> $DIR/fn-traits.rs:15:21
--> $DIR/fn-traits.rs:13:21
|
LL | fn call_mut(f: impl FnMut()) {
| ^^^^^^^ required by this bound in `call_mut`
error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
--> $DIR/fn-traits.rs:32:15
--> $DIR/fn-traits.rs:30:15
|
LL | call_once(foo_unsafe);
| --------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
@ -95,7 +95,7 @@ LL | call_once(foo_unsafe);
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
= note: `#[target_feature]` functions do not implement the `Fn` traits
note: required by a bound in `call_once`
--> $DIR/fn-traits.rs:19:22
--> $DIR/fn-traits.rs:17:22
|
LL | fn call_once(f: impl FnOnce()) {
| ^^^^^^^^ required by this bound in `call_once`

View file

@ -1,7 +1,5 @@
// check-pass
#![feature(target_feature_11)]
struct S<T>(T)
where
[T; (|| {}, 1).1]: Copy;

View file

@ -1,5 +1,5 @@
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:23:5
--> $DIR/safe-calls.rs:21:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@ -7,7 +7,7 @@ LL | sse2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:26:5
--> $DIR/safe-calls.rs:24:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@ -15,7 +15,7 @@ LL | avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:29:5
--> $DIR/safe-calls.rs:27:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@ -23,7 +23,7 @@ LL | Quux.avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:36:5
--> $DIR/safe-calls.rs:34:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@ -31,7 +31,7 @@ LL | avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:39:5
--> $DIR/safe-calls.rs:37:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@ -39,7 +39,7 @@ LL | Quux.avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:46:5
--> $DIR/safe-calls.rs:44:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@ -47,7 +47,7 @@ LL | sse2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:49:5
--> $DIR/safe-calls.rs:47:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@ -55,7 +55,7 @@ LL | avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:52:5
--> $DIR/safe-calls.rs:50:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@ -63,7 +63,7 @@ LL | Quux.avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:60:5
--> $DIR/safe-calls.rs:58:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@ -71,7 +71,7 @@ LL | sse2();
= note: can only be called if the required target features are available
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:65:18
--> $DIR/safe-calls.rs:63:18
|
LL | const name: () = sse2();
| ^^^^^^ call to function with `#[target_feature]`

View file

@ -2,8 +2,6 @@
// [thir]compile-flags: -Z thir-unsafeck
// only-x86_64
#![feature(target_feature_11)]
#[target_feature(enable = "sse2")]
const fn sse2() {}

View file

@ -1,5 +1,5 @@
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:23:5
--> $DIR/safe-calls.rs:21:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@ -7,7 +7,7 @@ LL | sse2();
= note: can only be called if the required target features are available
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:26:5
--> $DIR/safe-calls.rs:24:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@ -15,7 +15,7 @@ LL | avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:29:5
--> $DIR/safe-calls.rs:27:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@ -23,7 +23,7 @@ LL | Quux.avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:36:5
--> $DIR/safe-calls.rs:34:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@ -31,7 +31,7 @@ LL | avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:39:5
--> $DIR/safe-calls.rs:37:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@ -39,7 +39,7 @@ LL | Quux.avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:46:5
--> $DIR/safe-calls.rs:44:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@ -47,7 +47,7 @@ LL | sse2();
= note: can only be called if the required target features are available
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:49:5
--> $DIR/safe-calls.rs:47:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
@ -55,7 +55,7 @@ LL | avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:52:5
--> $DIR/safe-calls.rs:50:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
@ -63,7 +63,7 @@ LL | Quux.avx_bmi2();
= note: can only be called if the required target features are available
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:60:5
--> $DIR/safe-calls.rs:58:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
@ -71,7 +71,7 @@ LL | sse2();
= note: can only be called if the required target features are available
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:65:18
--> $DIR/safe-calls.rs:63:18
|
LL | const name: () = sse2();
| ^^^^^^ call to function with `#[target_feature]`

View file

@ -1,7 +1,5 @@
// only-x86_64
#![feature(target_feature_11)]
trait Foo {
fn foo(&self);
unsafe fn unsf_foo(&self);

View file

@ -1,5 +1,5 @@
error: `#[target_feature(..)]` cannot be applied to safe trait method
--> $DIR/trait-impl.rs:13:5
--> $DIR/trait-impl.rs:11:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method