@@ -125,7 +125,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
125
125
[ sym:: inline, ..] => self . check_inline ( hir_id, attr, span, target) ,
126
126
[ sym:: coverage, ..] => self . check_coverage ( attr, span, target) ,
127
127
[ sym:: optimize, ..] => self . check_optimize ( hir_id, attr, target) ,
128
- [ sym:: no_sanitize, ..] => self . check_no_sanitize ( hir_id, attr, span, target) ,
128
+ [ sym:: no_sanitize, ..] => {
129
+ self . check_applied_to_fn_or_method ( hir_id, attr, span, target)
130
+ }
129
131
[ sym:: non_exhaustive, ..] => self . check_non_exhaustive ( hir_id, attr, span, target) ,
130
132
[ sym:: marker, ..] => self . check_marker ( hir_id, attr, span, target) ,
131
133
[ sym:: target_feature, ..] => {
@@ -166,10 +168,13 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
166
168
self . check_rustc_legacy_const_generics ( hir_id, attr, span, target, item)
167
169
}
168
170
[ sym:: rustc_lint_query_instability, ..] => {
169
- self . check_rustc_lint_query_instability ( hir_id, attr, span, target)
171
+ self . check_applied_to_fn_or_method ( hir_id, attr, span, target)
172
+ }
173
+ [ sym:: rustc_lint_untracked_query_information, ..] => {
174
+ self . check_applied_to_fn_or_method ( hir_id, attr, span, target)
170
175
}
171
176
[ sym:: rustc_lint_diagnostics, ..] => {
172
- self . check_rustc_lint_diagnostics ( hir_id, attr, span, target)
177
+ self . check_applied_to_fn_or_method ( hir_id, attr, span, target)
173
178
}
174
179
[ sym:: rustc_lint_opt_ty, ..] => self . check_rustc_lint_opt_ty ( attr, span, target) ,
175
180
[ sym:: rustc_lint_opt_deny_field_access, ..] => {
@@ -245,6 +250,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
245
250
self . check_coroutine ( attr, target) ;
246
251
}
247
252
[ sym:: linkage, ..] => self . check_linkage ( attr, span, target) ,
253
+ [ sym:: rustc_pub_transparent, ..] => self . check_rustc_pub_transparent ( attr. span , span, attrs) ,
248
254
[
249
255
// ok
250
256
sym:: allow
@@ -451,11 +457,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
451
457
}
452
458
}
453
459
454
- /// Checks that `#[no_sanitize(..)]` is applied to a function or method.
455
- fn check_no_sanitize ( & self , hir_id : HirId , attr : & Attribute , span : Span , target : Target ) {
456
- self . check_applied_to_fn_or_method ( hir_id, attr, span, target)
457
- }
458
-
459
460
fn check_generic_attr (
460
461
& self ,
461
462
hir_id : HirId ,
@@ -1623,30 +1624,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1623
1624
}
1624
1625
}
1625
1626
1626
- /// Checks that the `#[rustc_lint_query_instability]` attribute is only applied to a function
1627
- /// or method.
1628
- fn check_rustc_lint_query_instability (
1629
- & self ,
1630
- hir_id : HirId ,
1631
- attr : & Attribute ,
1632
- span : Span ,
1633
- target : Target ,
1634
- ) {
1635
- self . check_applied_to_fn_or_method ( hir_id, attr, span, target)
1636
- }
1637
-
1638
- /// Checks that the `#[rustc_lint_diagnostics]` attribute is only applied to a function or
1639
- /// method.
1640
- fn check_rustc_lint_diagnostics (
1641
- & self ,
1642
- hir_id : HirId ,
1643
- attr : & Attribute ,
1644
- span : Span ,
1645
- target : Target ,
1646
- ) {
1647
- self . check_applied_to_fn_or_method ( hir_id, attr, span, target)
1648
- }
1649
-
1650
1627
/// Checks that the `#[rustc_lint_opt_ty]` attribute is only applied to a struct.
1651
1628
fn check_rustc_lint_opt_ty ( & self , attr : & Attribute , span : Span , target : Target ) {
1652
1629
match target {
@@ -2381,6 +2358,18 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2381
2358
}
2382
2359
}
2383
2360
}
2361
+
2362
+ fn check_rustc_pub_transparent ( & self , attr_span : Span , span : Span , attrs : & [ Attribute ] ) {
2363
+ if !attrs
2364
+ . iter ( )
2365
+ . filter ( |attr| attr. has_name ( sym:: repr) )
2366
+ . filter_map ( |attr| attr. meta_item_list ( ) )
2367
+ . flatten ( )
2368
+ . any ( |nmi| nmi. has_name ( sym:: transparent) )
2369
+ {
2370
+ self . dcx ( ) . emit_err ( errors:: RustcPubTransparent { span, attr_span } ) ;
2371
+ }
2372
+ }
2384
2373
}
2385
2374
2386
2375
impl < ' tcx > Visitor < ' tcx > for CheckAttrVisitor < ' tcx > {
0 commit comments