Skip to content

Commit a7428da

Browse files
incr.comp.: Do some various cleanup.
1 parent fecd92a commit a7428da

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

src/librustc/hir/def_id.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ impl serialize::UseSpecializedDecodable for CrateNum {
9797
RustcDecodable, Hash, Copy)]
9898
pub struct DefIndex(u32);
9999

100+
impl Idx for DefIndex {
101+
fn new(value: usize) -> Self {
102+
assert!(value < (u32::MAX) as usize);
103+
DefIndex(value as u32)
104+
}
105+
106+
fn index(self) -> usize {
107+
self.0 as usize
108+
}
109+
}
110+
100111
impl fmt::Debug for DefIndex {
101112
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
102113
write!(f,

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -876,17 +876,7 @@ impl<'hir> Map<'hir> {
876876

877877
Some(RootCrate(_)) => self.forest.krate.span,
878878
Some(NotPresent) | None => {
879-
// Some nodes, notably macro definitions, are not
880-
// present in the map for whatever reason, but
881-
// they *do* have def-ids. So if we encounter an
882-
// empty hole, check for that case.
883-
if let Some(def_index) = self.definitions.opt_def_index(id) {
884-
let def_path_hash = self.definitions.def_path_hash(def_index);
885-
self.dep_graph.read(def_path_hash.to_dep_node(DepKind::Hir));
886-
DUMMY_SP
887-
} else {
888-
bug!("hir::map::Map::span: id not in map: {:?}", id)
889-
}
879+
bug!("hir::map::Map::span: id not in map: {:?}", id)
890880
}
891881
}
892882
}

src/librustc_driver/pretty.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use {abort_on_err, driver};
2020
use rustc::ty::{self, TyCtxt, GlobalArenas, Resolutions};
2121
use rustc::cfg;
2222
use rustc::cfg::graphviz::LabelledCFG;
23-
use rustc::dep_graph::DepGraph;
2423
use rustc::middle::cstore::CrateStore;
2524
use rustc::session::Session;
2625
use rustc::session::config::{Input, OutputFilenames};
@@ -848,9 +847,6 @@ pub fn print_after_parsing(sess: &Session,
848847
krate: &ast::Crate,
849848
ppm: PpMode,
850849
ofile: Option<&Path>) {
851-
let dep_graph = DepGraph::new(false);
852-
let _ignore = dep_graph.in_ignore();
853-
854850
let (src, src_name) = get_source(input, sess);
855851

856852
let mut rdr = &*src;
@@ -893,9 +889,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
893889
output_filenames: &OutputFilenames,
894890
opt_uii: Option<UserIdentifiedItem>,
895891
ofile: Option<&Path>) {
896-
let dep_graph = DepGraph::new(false);
897-
let _ignore = dep_graph.in_ignore();
898-
899892
if ppm.needs_analysis() {
900893
print_with_analysis(sess,
901894
cstore,

0 commit comments

Comments
 (0)