diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2017-09-22 12:57:33 +0200 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2017-09-23 19:47:20 +0200 |
| commit | a7428da41581a0af2bf9990a193b151ab9b1b816 (patch) | |
| tree | 25a9c95c2f9d6459721ee7a4db5fbc970b4c975e | |
| parent | fecd92a7fe0b77adbb7f1a3d43fee436006fa6a5 (diff) | |
| download | rust-a7428da41581a0af2bf9990a193b151ab9b1b816.tar.gz rust-a7428da41581a0af2bf9990a193b151ab9b1b816.zip | |
incr.comp.: Do some various cleanup.
| -rw-r--r-- | src/librustc/hir/def_id.rs | 11 | ||||
| -rw-r--r-- | src/librustc/hir/map/mod.rs | 12 | ||||
| -rw-r--r-- | src/librustc_driver/pretty.rs | 7 |
3 files changed, 12 insertions, 18 deletions
diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 78daff9f67a..8e48352007b 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -97,6 +97,17 @@ impl serialize::UseSpecializedDecodable for CrateNum { RustcDecodable, Hash, Copy)] pub struct DefIndex(u32); +impl Idx for DefIndex { + fn new(value: usize) -> Self { + assert!(value < (u32::MAX) as usize); + DefIndex(value as u32) + } + + fn index(self) -> usize { + self.0 as usize + } +} + impl fmt::Debug for DefIndex { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index d003ec40a06..8ce2feab06c 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -876,17 +876,7 @@ impl<'hir> Map<'hir> { Some(RootCrate(_)) => self.forest.krate.span, Some(NotPresent) | None => { - // Some nodes, notably macro definitions, are not - // present in the map for whatever reason, but - // they *do* have def-ids. So if we encounter an - // empty hole, check for that case. - if let Some(def_index) = self.definitions.opt_def_index(id) { - let def_path_hash = self.definitions.def_path_hash(def_index); - self.dep_graph.read(def_path_hash.to_dep_node(DepKind::Hir)); - DUMMY_SP - } else { - bug!("hir::map::Map::span: id not in map: {:?}", id) - } + bug!("hir::map::Map::span: id not in map: {:?}", id) } } } diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index b633a170422..2f665af8433 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -20,7 +20,6 @@ use {abort_on_err, driver}; use rustc::ty::{self, TyCtxt, GlobalArenas, Resolutions}; use rustc::cfg; use rustc::cfg::graphviz::LabelledCFG; -use rustc::dep_graph::DepGraph; use rustc::middle::cstore::CrateStore; use rustc::session::Session; use rustc::session::config::{Input, OutputFilenames}; @@ -848,9 +847,6 @@ pub fn print_after_parsing(sess: &Session, krate: &ast::Crate, ppm: PpMode, ofile: Option<&Path>) { - let dep_graph = DepGraph::new(false); - let _ignore = dep_graph.in_ignore(); - let (src, src_name) = get_source(input, sess); let mut rdr = &*src; @@ -893,9 +889,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, output_filenames: &OutputFilenames, opt_uii: Option<UserIdentifiedItem>, ofile: Option<&Path>) { - let dep_graph = DepGraph::new(false); - let _ignore = dep_graph.in_ignore(); - if ppm.needs_analysis() { print_with_analysis(sess, cstore, |
