Skip to content

Commit 71278cb

Browse files
committed
Remove some unnecessary ATTR_* constants.
1 parent a605441 commit 71278cb

File tree

4 files changed

+17
-29
lines changed

4 files changed

+17
-29
lines changed

src/librustc/ich/mod.rs

+7-15
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,13 @@ mod impls_hir;
1212
mod impls_ty;
1313
mod impls_syntax;
1414

15-
pub const ATTR_DIRTY: Symbol = sym::rustc_dirty;
16-
pub const ATTR_CLEAN: Symbol = sym::rustc_clean;
17-
pub const ATTR_IF_THIS_CHANGED: Symbol = sym::rustc_if_this_changed;
18-
pub const ATTR_THEN_THIS_WOULD_NEED: Symbol = sym::rustc_then_this_would_need;
19-
pub const ATTR_PARTITION_REUSED: Symbol = sym::rustc_partition_reused;
20-
pub const ATTR_PARTITION_CODEGENED: Symbol = sym::rustc_partition_codegened;
21-
pub const ATTR_EXPECTED_CGU_REUSE: Symbol = sym::rustc_expected_cgu_reuse;
22-
2315
pub const IGNORED_ATTRIBUTES: &[Symbol] = &[
2416
sym::cfg,
25-
ATTR_IF_THIS_CHANGED,
26-
ATTR_THEN_THIS_WOULD_NEED,
27-
ATTR_DIRTY,
28-
ATTR_CLEAN,
29-
ATTR_PARTITION_REUSED,
30-
ATTR_PARTITION_CODEGENED,
31-
ATTR_EXPECTED_CGU_REUSE,
17+
sym::rustc_if_this_changed,
18+
sym::rustc_then_this_would_need,
19+
sym::rustc_dirty,
20+
sym::rustc_clean,
21+
sym::rustc_partition_reused,
22+
sym::rustc_partition_codegened,
23+
sym::rustc_expected_cgu_reuse,
3224
];

src/librustc_incremental/assert_dep_graph.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ use rustc_data_structures::graph::implementation::{
4444
};
4545
use rustc::hir;
4646
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
47-
use rustc::ich::{ATTR_IF_THIS_CHANGED, ATTR_THEN_THIS_WOULD_NEED};
4847
use std::env;
4948
use std::fs::{self, File};
5049
use std::io::Write;
51-
use syntax::ast;
50+
use syntax::{ast, symbol::sym};
5251
use syntax_pos::Span;
5352

5453
pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
@@ -78,7 +77,7 @@ pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
7877
assert!(tcx.sess.opts.debugging_opts.query_dep_graph,
7978
"cannot use the `#[{}]` or `#[{}]` annotations \
8079
without supplying `-Z query-dep-graph`",
81-
ATTR_IF_THIS_CHANGED, ATTR_THEN_THIS_WOULD_NEED);
80+
sym::rustc_if_this_changed, sym::rustc_then_this_would_need);
8281
}
8382

8483
// Check paths.
@@ -114,7 +113,7 @@ impl IfThisChanged<'tcx> {
114113
let def_id = self.tcx.hir().local_def_id(hir_id);
115114
let def_path_hash = self.tcx.def_path_hash(def_id);
116115
for attr in attrs {
117-
if attr.check_name(ATTR_IF_THIS_CHANGED) {
116+
if attr.check_name(sym::rustc_if_this_changed) {
118117
let dep_node_interned = self.argument(attr);
119118
let dep_node = match dep_node_interned {
120119
None => def_path_hash.to_dep_node(DepKind::Hir),
@@ -130,7 +129,7 @@ impl IfThisChanged<'tcx> {
130129
}
131130
};
132131
self.if_this_changed.push((attr.span, def_id, dep_node));
133-
} else if attr.check_name(ATTR_THEN_THIS_WOULD_NEED) {
132+
} else if attr.check_name(sym::rustc_then_this_would_need) {
134133
let dep_node_interned = self.argument(attr);
135134
let dep_node = match dep_node_interned {
136135
Some(n) => {

src/librustc_incremental/assert_module_sources.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ use rustc::ty::TyCtxt;
2828
use std::collections::BTreeSet;
2929
use syntax::ast;
3030
use syntax::symbol::{Symbol, sym};
31-
use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED,
32-
ATTR_EXPECTED_CGU_REUSE};
3331

3432
pub fn assert_module_sources(tcx: TyCtxt<'_>) {
3533
tcx.dep_graph.with_ignore(|| {
@@ -62,11 +60,11 @@ struct AssertModuleSource<'tcx> {
6260

6361
impl AssertModuleSource<'tcx> {
6462
fn check_attr(&self, attr: &ast::Attribute) {
65-
let (expected_reuse, comp_kind) = if attr.check_name(ATTR_PARTITION_REUSED) {
63+
let (expected_reuse, comp_kind) = if attr.check_name(sym::rustc_partition_reused) {
6664
(CguReuse::PreLto, ComparisonKind::AtLeast)
67-
} else if attr.check_name(ATTR_PARTITION_CODEGENED) {
65+
} else if attr.check_name(sym::rustc_partition_codegened) {
6866
(CguReuse::No, ComparisonKind::Exact)
69-
} else if attr.check_name(ATTR_EXPECTED_CGU_REUSE) {
67+
} else if attr.check_name(sym::rustc_expected_cgu_reuse) {
7068
match &*self.field(attr, sym::kind).as_str() {
7169
"no" => (CguReuse::No, ComparisonKind::Exact),
7270
"pre-lto" => (CguReuse::PreLto, ComparisonKind::Exact),

src/librustc_incremental/persist/dirty_clean.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use rustc::hir::Node as HirNode;
2222
use rustc::hir::def_id::DefId;
2323
use rustc::hir::itemlikevisit::ItemLikeVisitor;
2424
use rustc::hir::intravisit;
25-
use rustc::ich::{ATTR_DIRTY, ATTR_CLEAN};
2625
use rustc::ty::TyCtxt;
2726
use rustc_data_structures::fingerprint::Fingerprint;
2827
use rustc_data_structures::fx::FxHashSet;
@@ -224,7 +223,7 @@ pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) {
224223

225224
let mut all_attrs = FindAllAttrs {
226225
tcx,
227-
attr_names: vec![ATTR_DIRTY, ATTR_CLEAN],
226+
attr_names: vec![sym::rustc_dirty, sym::rustc_clean],
228227
found_attrs: vec![],
229228
};
230229
intravisit::walk_crate(&mut all_attrs, krate);
@@ -246,9 +245,9 @@ impl DirtyCleanVisitor<'tcx> {
246245
fn assertion_maybe(&mut self, item_id: hir::HirId, attr: &Attribute)
247246
-> Option<Assertion>
248247
{
249-
let is_clean = if attr.check_name(ATTR_DIRTY) {
248+
let is_clean = if attr.check_name(sym::rustc_dirty) {
250249
false
251-
} else if attr.check_name(ATTR_CLEAN) {
250+
} else if attr.check_name(sym::rustc_clean) {
252251
true
253252
} else {
254253
// skip: not rustc_clean/dirty

0 commit comments

Comments
 (0)