Move some constants to rustc::ich.

This commit is contained in:
Michael Woerister 2017-03-20 18:09:59 +01:00
parent 9af97e7ff2
commit 03b8091d10
5 changed files with 21 additions and 22 deletions

View File

@ -15,3 +15,20 @@ pub use self::caching_codemap_view::CachingCodemapView;
mod fingerprint;
mod def_path_hash;
mod caching_codemap_view;
pub const ATTR_DIRTY: &'static str = "rustc_dirty";
pub const ATTR_CLEAN: &'static str = "rustc_clean";
pub const ATTR_DIRTY_METADATA: &'static str = "rustc_metadata_dirty";
pub const ATTR_CLEAN_METADATA: &'static str = "rustc_metadata_clean";
pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[
"cfg",
ATTR_IF_THIS_CHANGED,
ATTR_THEN_THIS_WOULD_NEED,
ATTR_DIRTY,
ATTR_CLEAN,
ATTR_DIRTY_METADATA,
ATTR_CLEAN_METADATA
];

View File

@ -52,13 +52,13 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::graph::{Direction, INCOMING, OUTGOING, NodeIndex};
use rustc::hir;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::ich::{ATTR_IF_THIS_CHANGED, ATTR_THEN_THIS_WOULD_NEED};
use graphviz::IntoCow;
use std::env;
use std::fs::File;
use std::io::Write;
use syntax::ast;
use syntax_pos::Span;
use {ATTR_IF_THIS_CHANGED, ATTR_THEN_THIS_WOULD_NEED};
pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let _ignore = tcx.dep_graph.in_ignore();

View File

@ -26,22 +26,12 @@ use rustc::hir::*;
use rustc::hir::def::Def;
use rustc::hir::def_id::DefId;
use rustc::hir::intravisit::{self as visit, Visitor};
use rustc::ich::{DefPathHashes, CachingCodemapView};
use rustc::ich::{DefPathHashes, CachingCodemapView, IGNORED_ATTRIBUTES};
use rustc::ty::TyCtxt;
use std::hash::{Hash, Hasher};
use super::IchHasher;
const IGNORED_ATTRIBUTES: &'static [&'static str] = &[
"cfg",
::ATTR_IF_THIS_CHANGED,
::ATTR_THEN_THIS_WOULD_NEED,
::ATTR_DIRTY,
::ATTR_CLEAN,
::ATTR_DIRTY_METADATA,
::ATTR_CLEAN_METADATA
];
pub struct StrictVersionHashVisitor<'a, 'hash: 'a, 'tcx: 'hash> {
pub tcx: TyCtxt<'hash, 'tcx, 'tcx>,
pub st: &'a mut IchHasher,

View File

@ -36,13 +36,6 @@ extern crate serialize as rustc_serialize;
extern crate syntax;
extern crate syntax_pos;
const ATTR_DIRTY: &'static str = "rustc_dirty";
const ATTR_CLEAN: &'static str = "rustc_clean";
const ATTR_DIRTY_METADATA: &'static str = "rustc_metadata_dirty";
const ATTR_CLEAN_METADATA: &'static str = "rustc_metadata_clean";
const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
mod assert_dep_graph;
mod calculate_svh;
mod persist;

View File

@ -47,14 +47,13 @@ use rustc::hir;
use rustc::hir::def_id::DefId;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::intravisit;
use rustc::ich::Fingerprint;
use rustc::ich::{Fingerprint, ATTR_DIRTY, ATTR_CLEAN, ATTR_DIRTY_METADATA,
ATTR_CLEAN_METADATA};
use syntax::ast::{self, Attribute, NestedMetaItem};
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use syntax_pos::Span;
use rustc::ty::TyCtxt;
use {ATTR_DIRTY, ATTR_CLEAN, ATTR_DIRTY_METADATA, ATTR_CLEAN_METADATA};
const LABEL: &'static str = "label";
const CFG: &'static str = "cfg";