@@ -158,6 +158,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
158158 Attribute :: Parsed ( AttributeKind :: AsPtr ( attr_span) ) => {
159159 self . check_applied_to_fn_or_method ( hir_id, * attr_span, span, target)
160160 }
161+ & Attribute :: Parsed ( AttributeKind :: PubTransparent ( attr_span) ) => {
162+ if !find_attr ! (
163+ attrs,
164+ AttributeKind :: Repr ( r) => r. iter( ) . any( |( r, _) | r == & ReprAttr :: ReprTransparent )
165+ ) . unwrap_or ( false ) {
166+ self . dcx ( ) . emit_err ( errors:: RustcPubTransparent { span, attr_span } ) ;
167+ }
168+ }
161169 Attribute :: Unparsed ( _) => {
162170 match attr. path ( ) . as_slice ( ) {
163171 [ sym:: diagnostic, sym:: do_not_recommend, ..] => {
@@ -283,7 +291,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
283291 self . check_type_const ( hir_id, attr, target) ;
284292 }
285293 [ sym:: linkage, ..] => self . check_linkage ( attr, span, target) ,
286- [ sym:: rustc_pub_transparent, ..] => self . check_rustc_pub_transparent ( attr. span ( ) , span, attrs) ,
287294 [
288295 // ok
289296 sym:: allow
@@ -2660,14 +2667,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
26602667 }
26612668 }
26622669
2663- fn check_rustc_pub_transparent ( & self , attr_span : Span , span : Span , attrs : & [ Attribute ] ) {
2664- if !find_attr ! ( attrs, AttributeKind :: Repr ( r) => r. iter( ) . any( |( r, _) | r == & ReprAttr :: ReprTransparent ) )
2665- . unwrap_or ( false )
2666- {
2667- self . dcx ( ) . emit_err ( errors:: RustcPubTransparent { span, attr_span } ) ;
2668- }
2669- }
2670-
26712670 fn check_rustc_force_inline (
26722671 & self ,
26732672 hir_id : HirId ,
0 commit comments