Skip to content

Commit

Permalink
Also forbid target_feature annotated methods from being lang items
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 13, 2024
1 parent 5a6036a commit 3a64bef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
attrs: &[Attribute],
) {
match target {
Target::Fn => {
Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent)
| Target::Fn => {
// `#[target_feature]` is not allowed in lang items.
if let Some((lang_item, _)) = hir::lang_items::extract(attrs)
// Calling functions with `#[target_feature]` is
Expand All @@ -732,7 +733,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
});
}
}
Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => {}
// FIXME: #[target_feature] was previously erroneously allowed on statements and some
// crates used this, so only emit a warning.
Target::Statement => {
Expand Down

0 comments on commit 3a64bef

Please sign in to comment.