Skip to content

Commit 23288f4

Browse files
committed
Avoid panic
Signed-off-by: xizheyin <[email protected]>
1 parent bb7bd01 commit 23288f4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustdoc/passes/strip_hidden.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ impl DocFolder for Stripper<'_, '_> {
9090
let has_doc_hidden = i.is_doc_hidden();
9191

9292
if let clean::ImportItem(clean::Import { source, .. }) = &i.kind {
93-
if let Some(source_did) = source.did {
94-
let import_def_id = i.def_id().unwrap().expect_local();
93+
if let Some(source_did) = source.did
94+
&& let Some(import_def_id) = i.def_id().and_then(|def_id| def_id.as_local())
95+
{
9596
let reexports = reexport_chain(self.tcx, import_def_id, source_did);
9697

9798
// Check if any reexport in the chain has a hidden source

0 commit comments

Comments
 (0)