diff options
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index d57cba6420f..3ffe488caef 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1120,41 +1120,17 @@ impl CheckAttrVisitor<'tcx> { let mut is_transparent = false; for hint in &hints { - if !hint.is_meta_item() { - struct_span_err!( - self.tcx.sess, - hint.span(), - E0565, - "meta item in `repr` must be an identifier" - ) - .emit(); - continue; - } - let (article, allowed_targets) = match hint.name_or_empty() { - sym::C => { - is_c = true; + _ if !matches!(target, Target::Struct | Target::Enum | Target::Union) => { + ("a", "struct, enum, or union") + } + name @ sym::C | name @ sym::align => { + is_c |= name == sym::C; match target { Target::Struct | Target::Union | Target::Enum => continue, _ => ("a", "struct, enum, or union"), } } - sym::align => { - if let (Target::Fn, true) = (target, !self.tcx.features().fn_align) { - feature_err( - &self.tcx.sess.parse_sess, - sym::fn_align, - hint.span(), - "`repr(align)` attributes on functions are unstable", - ) - .emit(); - } - - match target { - Target::Struct | Target::Union | Target::Enum | Target::Fn => continue, - _ => ("a", "struct, enum, function, or union"), - } - } sym::packed => { if target != Target::Struct && target != Target::Union { ("a", "struct or union") @@ -1211,17 +1187,7 @@ impl CheckAttrVisitor<'tcx> { continue; } } - _ => { - struct_span_err!( - self.tcx.sess, - hint.span(), - E0552, - "unrecognized representation hint" - ) - .emit(); - - continue; - } + _ => continue, }; struct_span_err!( |
