diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 7679582f881..c94de9aec30 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -171,7 +171,7 @@ impl CheckAttrVisitor<'tcx> { target: Target, ) -> bool { match target { - _ if self.tcx.sess.contains_name(attrs, sym::naked) => { + _ if attrs.iter().any(|attr| attr.has_name(sym::naked)) => { struct_span_err!( self.tcx.sess, *attr_span,