Skip to content

Commit 4125b27

Browse files
committed
rustdoc: NodeId is now DefId
1 parent eb48d6b commit 4125b27

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/librustdoc/html/render.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub struct Cache {
284284
/// found on that implementation.
285285
pub impls: FxHashMap<DefId, Vec<Impl>>,
286286

287-
/// Maintains a mapping of local crate `NodeId`s to the fully qualified name
287+
/// Maintains a mapping of local crate `DefId`s to the fully qualified name
288288
/// and "short type description" of that node. This is used when generating
289289
/// URLs when a type is being linked to. External paths are not located in
290290
/// this map because the `External` type itself has all the information
@@ -702,7 +702,7 @@ pub fn run(mut krate: clean::Crate,
702702

703703
/// Builds the search index from the collected metadata
704704
fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
705-
let mut nodeid_to_pathid = FxHashMap::default();
705+
let mut defid_to_pathid = FxHashMap::default();
706706
let mut crate_items = Vec::with_capacity(cache.search_index.len());
707707
let mut crate_paths = Vec::<Json>::new();
708708

@@ -726,21 +726,21 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
726726
}
727727
}
728728

729-
// Reduce `NodeId` in paths into smaller sequential numbers,
729+
// Reduce `DefId` in paths into smaller sequential numbers,
730730
// and prune the paths that do not appear in the index.
731731
let mut lastpath = String::new();
732732
let mut lastpathid = 0usize;
733733

734734
for item in search_index {
735-
item.parent_idx = item.parent.map(|nodeid| {
736-
if nodeid_to_pathid.contains_key(&nodeid) {
737-
*nodeid_to_pathid.get(&nodeid).unwrap()
735+
item.parent_idx = item.parent.map(|defid| {
736+
if defid_to_pathid.contains_key(&defid) {
737+
*defid_to_pathid.get(&defid).unwrap()
738738
} else {
739739
let pathid = lastpathid;
740-
nodeid_to_pathid.insert(nodeid, pathid);
740+
defid_to_pathid.insert(defid, pathid);
741741
lastpathid += 1;
742742

743-
let &(ref fqp, short) = paths.get(&nodeid).unwrap();
743+
let &(ref fqp, short) = paths.get(&defid).unwrap();
744744
crate_paths.push(((short as usize), fqp.last().unwrap().clone()).to_json());
745745
pathid
746746
}

0 commit comments

Comments
 (0)