about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-24 01:32:32 +0000
committerbors <bors@rust-lang.org>2021-03-24 01:32:32 +0000
commitdb492ecd5ba6bd82205612cebb9034710653f0c2 (patch)
treeb7c353ead50b6fac246982ac11529822593427bb /compiler/rustc_passes/src
parent673d0db5e393e9c64897005b470bfeb6d5aec61b (diff)
parent5c0d880e4be68c98affee9cc5d40519dcf1e3b7b (diff)
downloadrust-db492ecd5ba6bd82205612cebb9034710653f0c2.tar.gz
rust-db492ecd5ba6bd82205612cebb9034710653f0c2.zip
Auto merge of #83432 - Dylan-DPC:rollup-4z5f6al, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #83051 (Sidebar trait items order)
 - #83313 (Only enable assert_dep_graph when query-dep-graph is enabled.)
 - #83353 (Add internal io::Error::new_const to avoid allocations.)
 - #83391 (Allow not emitting `uwtable` on Android)
 - #83392 (Change `-W help` to display edition level.)
 - #83393 (Codeblock tooltip position)
 - #83399 (rustdoc: Record crate name instead of using `None`)
 - #83405 (Slight visual improvements to warning boxes in the docs)
 - #83415 (Remove unnecessary `Option` wrapping around `Crate.module`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index d91d0e1765b..85add83f88b 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -99,6 +99,12 @@ impl CheckAttrVisitor<'tcx> {
                 self.check_naked(hir_id, attr, span, target)
             } else if self.tcx.sess.check_name(attr, sym::rustc_legacy_const_generics) {
                 self.check_rustc_legacy_const_generics(&attr, span, target, item)
+            } else if self.tcx.sess.check_name(attr, sym::rustc_clean)
+                || self.tcx.sess.check_name(attr, sym::rustc_dirty)
+                || self.tcx.sess.check_name(attr, sym::rustc_if_this_changed)
+                || self.tcx.sess.check_name(attr, sym::rustc_then_this_would_need)
+            {
+                self.check_rustc_dirty_clean(&attr)
             } else {
                 // lint-only checks
                 if self.tcx.sess.check_name(attr, sym::cold) {
@@ -1012,6 +1018,20 @@ impl CheckAttrVisitor<'tcx> {
         }
     }
 
+    /// Checks that the dep-graph debugging attributes are only present when the query-dep-graph
+    /// option is passed to the compiler.
+    fn check_rustc_dirty_clean(&self, attr: &Attribute) -> bool {
+        if self.tcx.sess.opts.debugging_opts.query_dep_graph {
+            true
+        } else {
+            self.tcx
+                .sess
+                .struct_span_err(attr.span, "attribute requires -Z query-dep-graph to be enabled")
+                .emit();
+            false
+        }
+    }
+
     /// Checks if `#[link_section]` is applied to a function or static.
     fn check_link_section(&self, hir_id: HirId, attr: &Attribute, span: &Span, target: Target) {
         match target {