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, ofile: Option<&Path>) { - let dep_graph = DepGraph::new(false); - let _ignore = dep_graph.in_ignore(); - if ppm.needs_analysis() { print_with_analysis(sess, cstore,