diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-03-24 01:52:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-24 01:52:28 +0100 |
| commit | 2f611da1d66ae98b53358bcb7739884524b7e18d (patch) | |
| tree | 1d50eac4a06f1667e6eb2f16f2a49437802b1880 /compiler/rustc_passes/src | |
| parent | f134ca3864f8c66d6dd01e576ce9b0125eb58210 (diff) | |
| parent | 31447f6f087e2654d2927f04488303500bec3280 (diff) | |
| download | rust-2f611da1d66ae98b53358bcb7739884524b7e18d.tar.gz rust-2f611da1d66ae98b53358bcb7739884524b7e18d.zip | |
Rollup merge of #83313 - cjgillot:assert, r=michaelwoerister
Only enable assert_dep_graph when query-dep-graph is enabled. This is a debugging option. The only effect should be on rustc tests. r? ``@michaelwoerister``
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 20 |
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 { |
