@@ -154,6 +154,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
154154 Attribute :: Parsed ( AttributeKind :: AsPtr ( attr_span) ) => {
155155 self . check_applied_to_fn_or_method ( hir_id, * attr_span, span, target)
156156 }
157+ & Attribute :: Parsed ( AttributeKind :: PubTransparent ( attr_span) ) => {
158+ if !find_attr ! (
159+ attrs,
160+ AttributeKind :: Repr ( r) => r. iter( ) . any( |( r, _) | r == & ReprAttr :: ReprTransparent )
161+ ) . unwrap_or ( false ) {
162+ self . dcx ( ) . emit_err ( errors:: RustcPubTransparent { span, attr_span } ) ;
163+ }
164+ }
157165 Attribute :: Unparsed ( _) => {
158166 match attr. path ( ) . as_slice ( ) {
159167 [ sym:: diagnostic, sym:: do_not_recommend, ..] => {
@@ -279,7 +287,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
279287 self . check_type_const ( hir_id, attr, target) ;
280288 }
281289 [ sym:: linkage, ..] => self . check_linkage ( attr, span, target) ,
282- [ sym:: rustc_pub_transparent, ..] => self . check_rustc_pub_transparent ( attr. span ( ) , span, attrs) ,
283290 [
284291 // ok
285292 sym:: allow
@@ -2643,14 +2650,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
26432650 }
26442651 }
26452652
2646- fn check_rustc_pub_transparent ( & self , attr_span : Span , span : Span , attrs : & [ Attribute ] ) {
2647- if !find_attr ! ( attrs, AttributeKind :: Repr ( r) => r. iter( ) . any( |( r, _) | r == & ReprAttr :: ReprTransparent ) )
2648- . unwrap_or ( false )
2649- {
2650- self . dcx ( ) . emit_err ( errors:: RustcPubTransparent { span, attr_span } ) ;
2651- }
2652- }
2653-
26542653 fn check_rustc_force_inline (
26552654 & self ,
26562655 hir_id : HirId ,
0 commit comments