@@ -99,6 +99,12 @@ impl CheckAttrVisitor<'tcx> {
9999 self . check_naked ( hir_id, attr, span, target)
100100 } else if self . tcx . sess . check_name ( attr, sym:: rustc_legacy_const_generics) {
101101 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)
102108 } else {
103109 // lint-only checks
104110 if self . tcx . sess . check_name ( attr, sym:: cold) {
@@ -1012,6 +1018,19 @@ impl CheckAttrVisitor<'tcx> {
10121018 }
10131019 }
10141020
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+
10151034 /// Checks if `#[link_section]` is applied to a function or static.
10161035 fn check_link_section ( & self , hir_id : HirId , attr : & Attribute , span : & Span , target : Target ) {
10171036 match target {
0 commit comments