use serialize::json::{self, ToJson};
use syntax::{abi, ast, attr};
use rustc::metadata::cstore::LOCAL_CRATE;
-use rustc::middle::def_id::DefId;
+use rustc::middle::def_id::{CRATE_DEF_INDEX, DefId};
use rustc::util::nodemap::DefIdSet;
use rustc_front::hir;
for &(n, ref e) in &krate.externs {
cache.extern_locations.insert(n, (e.name.clone(),
extern_location(e, &cx.dst)));
- let did = DefId { krate: n, xxx_node: ast::CRATE_NODE_ID };
+ let did = DefId { krate: n, index: CRATE_DEF_INDEX };
cache.paths.insert(did, (vec![e.name.to_string()], ItemType::Module));
}
ref t => {
match t.primitive_type() {
Some(prim) => {
- let did = DefId::xxx_local(prim.to_node_id()); // TODO
+ let did = DefId::local(prim.to_def_index());
self.parent_stack.push(did);
true
}
ref t => {
t.primitive_type().and_then(|t| {
self.primitive_locations.get(&t).map(|n| {
- let id = t.to_node_id();
- DefId { krate: *n, xxx_node: id }
+ let id = t.to_def_index();
+ DefId { krate: *n, index: id }
})
})
}
root = root,
path = path[..path.len() - 1].join("/"),
file = item_path(self.item),
- goto = self.item.def_id.xxx_node))
+ goto = self.item.def_id.index.as_usize()))
}
}
}
Some(l) => {
try!(write!(fmt, "<a id='src-{}' class='srclink' \
href='{}' title='{}'>[src]</a>",
- self.item.def_id.xxx_node, l, "goto source code"));
+ self.item.def_id.index.as_usize(), l, "goto source code"));
}
None => {}
}
_ => {
if let Some(prim) = target.primitive_type() {
if let Some(c) = cache().primitive_locations.get(&prim) {
- let did = DefId { krate: *c, xxx_node: prim.to_node_id() };
+ let did = DefId { krate: *c, index: prim.to_def_index() };
try!(render_assoc_items(w, cx, did, what));
}
}