]> git.lizzy.rs Git - rust.git/commitdiff
incr.comp.: Do some various cleanup.
authorMichael Woerister <michaelwoerister@posteo>
Fri, 22 Sep 2017 10:57:33 +0000 (12:57 +0200)
committerMichael Woerister <michaelwoerister@posteo>
Sat, 23 Sep 2017 17:47:20 +0000 (19:47 +0200)
src/librustc/hir/def_id.rs
src/librustc/hir/map/mod.rs
src/librustc_driver/pretty.rs

index 78daff9f67aa5dde75bc1ba8e590a89b113d4cc3..8e48352007b374d9942028a19e40fce1965c5635 100644 (file)
@@ -97,6 +97,17 @@ fn default_decode<D: Decoder>(d: &mut D) -> Result<CrateNum, D::Error> {
            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,
index d003ec40a06bd6563fc7005221d0339f8acf0398..8ce2feab06cef06ee6ba75b3b55922e3f7c763cd 100644 (file)
@@ -876,17 +876,7 @@ pub fn span(&self, id: NodeId) -> Span {
 
             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)
             }
         }
     }
index b633a170422eb95f31fc7d0bcf6fdc961e968060..2f665af8433b94a0863890e96b0a077e7df1211d 100644 (file)
@@ -20,7 +20,6 @@
 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,