mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-28 05:34:45 +00:00

This uses the feature gate for https://github.com/rust-lang/rust/issues/143352, but is described in https://github.com/rust-lang/rfcs/pull/3820 which is strongly tied to the experiment.
28 lines
721 B
Rust
28 lines
721 B
Rust
//@ revisions: default feature
|
|
//@ only-x86_64
|
|
#![cfg_attr(feature, feature(effective_target_features))]
|
|
//[feature]~^ WARN the feature `effective_target_features` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
|
|
trait Foo {
|
|
fn foo(&self);
|
|
}
|
|
|
|
struct Bar;
|
|
|
|
impl Foo for Bar {
|
|
#[unsafe(force_target_feature(enable = "avx2"))]
|
|
//[default]~^ ERROR the `#[force_target_feature]` attribute is an experimental feature
|
|
fn foo(&self) {}
|
|
}
|
|
|
|
struct Bar2;
|
|
|
|
impl Foo for Bar2 {
|
|
#[target_feature(enable = "avx2")]
|
|
//~^ ERROR `#[target_feature(..)]` cannot be applied to safe trait method
|
|
fn foo(&self) {}
|
|
//~^ ERROR method `foo` has an incompatible type for trait
|
|
}
|
|
|
|
fn main() {}
|