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,
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)
}
}
}
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};
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;
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,