Skip to content

Commit ebc8cb4

Browse files
committed
Turn NoParentItem from a panic into an ICE
1 parent 19d1002 commit ebc8cb4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
541541
})
542542
} else {
543543
debug!("attempting to resolve item without parent module: {}", path_str);
544-
// TODO: maybe this should just be an ICE?
545544
Err(ErrorKind::Resolve(ResolutionFailure::NoParentItem))
546545
}
547546
}
@@ -1462,7 +1461,8 @@ fn resolution_failure(
14621461
}
14631462
}
14641463
ResolutionFailure::NoParentItem => {
1465-
panic!("all intra doc links should have a parent item")
1464+
diag.level = rustc_errors::Level::Bug;
1465+
diag.note("all intra doc links should have a parent item");
14661466
}
14671467
ResolutionFailure::NoPrimitiveImpl(res, _) => {
14681468
let note = format!(
@@ -1694,7 +1694,6 @@ fn handle_variant(
16941694
let parent = if let Some(parent) = cx.tcx.parent(res.def_id()) {
16951695
parent
16961696
} else {
1697-
// TODO: this should just be an unwrap, there should never be `Variant`s without a parent
16981697
return Err(ErrorKind::Resolve(ResolutionFailure::NoParentItem));
16991698
};
17001699
let parent_def = Res::Def(DefKind::Enum, parent);

0 commit comments

Comments
 (0)