@@ -158,6 +158,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
158
158
Attribute :: Parsed ( AttributeKind :: AsPtr ( attr_span) ) => {
159
159
self . check_applied_to_fn_or_method ( hir_id, * attr_span, span, target)
160
160
}
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
+ }
161
169
Attribute :: Unparsed ( _) => {
162
170
match attr. path ( ) . as_slice ( ) {
163
171
[ sym:: diagnostic, sym:: do_not_recommend, ..] => {
@@ -283,7 +291,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
283
291
self . check_type_const ( hir_id, attr, target) ;
284
292
}
285
293
[ sym:: linkage, ..] => self . check_linkage ( attr, span, target) ,
286
- [ sym:: rustc_pub_transparent, ..] => self . check_rustc_pub_transparent ( attr. span ( ) , span, attrs) ,
287
294
[
288
295
// ok
289
296
sym:: allow
@@ -2660,14 +2667,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2660
2667
}
2661
2668
}
2662
2669
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
-
2671
2670
fn check_rustc_force_inline (
2672
2671
& self ,
2673
2672
hir_id : HirId ,
0 commit comments