@@ -99,6 +99,12 @@ impl CheckAttrVisitor<'tcx> {
99
99
self . check_naked ( hir_id, attr, span, target)
100
100
} else if self . tcx . sess . check_name ( attr, sym:: rustc_legacy_const_generics) {
101
101
self . check_rustc_legacy_const_generics ( & attr, span, target, item)
102
+ } else if self . tcx . sess . check_name ( attr, sym:: rustc_clean)
103
+ || self . tcx . sess . check_name ( attr, sym:: rustc_dirty)
104
+ || self . tcx . sess . check_name ( attr, sym:: rustc_if_this_changed)
105
+ || self . tcx . sess . check_name ( attr, sym:: rustc_then_this_would_need)
106
+ {
107
+ self . check_rustc_dirty_clean ( & attr)
102
108
} else {
103
109
// lint-only checks
104
110
if self . tcx . sess . check_name ( attr, sym:: cold) {
@@ -1012,6 +1018,19 @@ impl CheckAttrVisitor<'tcx> {
1012
1018
}
1013
1019
}
1014
1020
1021
+ /// Checks if `#[rustc_legacy_const_generics]` is applied to a function and has a valid argument.
1022
+ fn check_rustc_dirty_clean ( & self , attr : & Attribute ) -> bool {
1023
+ if self . tcx . sess . opts . debugging_opts . query_dep_graph {
1024
+ true
1025
+ } else {
1026
+ self . tcx
1027
+ . sess
1028
+ . struct_span_err ( attr. span , "attribute requires -Z query-dep-graph to be enabled" )
1029
+ . emit ( ) ;
1030
+ false
1031
+ }
1032
+ }
1033
+
1015
1034
/// Checks if `#[link_section]` is applied to a function or static.
1016
1035
fn check_link_section ( & self , hir_id : HirId , attr : & Attribute , span : & Span , target : Target ) {
1017
1036
match target {
0 commit comments