Skip to content

Commit 3a64bef

Browse files
committed
Also forbid target_feature annotated methods from being lang items
1 parent 5a6036a commit 3a64bef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_passes/src/check_attr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
715715
attrs: &[Attribute],
716716
) {
717717
match target {
718-
Target::Fn => {
718+
Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent)
719+
| Target::Fn => {
719720
// `#[target_feature]` is not allowed in lang items.
720721
if let Some((lang_item, _)) = hir::lang_items::extract(attrs)
721722
// Calling functions with `#[target_feature]` is
@@ -732,7 +733,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
732733
});
733734
}
734735
}
735-
Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {}
736736
// FIXME: #[target_feature] was previously erroneously allowed on statements and some
737737
// crates used this, so only emit a warning.
738738
Target::Statement => {

0 commit comments

Comments
 (0)