Skip to content

Commit 2865d65

Browse files
committed
Workaround panic in rustdoc
1 parent 3760d1d commit 2865d65

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/librustdoc/html/render.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,13 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result<String> {
533533
try!(write!(&mut w, r#"],"paths":["#));
534534

535535
for (i, &did) in pathid_to_nodeid.iter().enumerate() {
536-
let &(ref fqp, short) = cache.paths.get(&did).unwrap();
537-
if i > 0 {
538-
try!(write!(&mut w, ","));
536+
if let Some(&(ref fqp, short)) = cache.paths.get(&did) {
537+
if i > 0 {
538+
try!(write!(&mut w, ","));
539+
}
540+
try!(write!(&mut w, r#"[{},"{}"]"#,
541+
short as usize, *fqp.last().unwrap()));
539542
}
540-
try!(write!(&mut w, r#"[{},"{}"]"#,
541-
short as usize, *fqp.last().unwrap()));
542543
}
543544

544545
try!(write!(&mut w, "]}};"));

0 commit comments

Comments
 (0)