Closed
Description
The compiler currently allows safe default method implementations to be marked with #[target_feature]
:
trait Foo {
#[target_feature(enable = "avx2")] // no error
fn foo() {}
}
which I don't think is allowed in RFC 2396. For reference, #[target_feature]
is not allowed on trait implementations:
struct Bar;
impl Foo for Bar {
#[target_feature(enable = "avx2")] // error: cannot be applied to safe trait method
fn foo() {}
}
From my limited testing, this doesn't seem to be unsound however, as the compiler seems to consider all implementations of Foo::foo
as having #[target_feature(enable = "avx2")]
.
cc #69098
@rustbot label T-lang T-compiler C-bug F-target_feature_11
Metadata
Metadata
Assignees
Labels
Area: Enabling/disabling target features like AVX, Neon, etc.Category: This is a bug.target feature 1.1 RFCRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.