Skip to content

Commit 2d3d6bc

Browse files
committed
Fix another ICE in rustdoc scrape_examples
1 parent d2c24aa commit 2d3d6bc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/librustdoc/scrape_examples.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,19 @@ where
142142
hir::ExprKind::Call(f, _) => {
143143
let types = tcx.typeck(ex.hir_id.owner);
144144

145-
match types.node_type_opt(f.hir_id) {
146-
Some(ty) => (ty, ex.span),
147-
None => {
148-
return;
149-
}
145+
if let Some(ty) = types.node_type_opt(f.hir_id) {
146+
(ty, ex.span)
147+
} else {
148+
return;
150149
}
151150
}
152151
hir::ExprKind::MethodCall(_, _, _, span) => {
153152
let types = tcx.typeck(ex.hir_id.owner);
154-
let def_id = types.type_dependent_def_id(ex.hir_id).unwrap();
153+
let def_id = if let Some(def_id) = types.type_dependent_def_id(ex.hir_id) {
154+
def_id
155+
} else {
156+
return;
157+
};
155158
(tcx.type_of(def_id), span)
156159
}
157160
_ => {

0 commit comments

Comments
 (0)