Fix another ICE in rustdoc scrape_examples

This commit is contained in:
Deadbeef
2021-11-05 22:37:33 +08:00
parent d2c24aabcd
commit 2d3d6bc5a2

View File

@@ -142,16 +142,19 @@ where
hir::ExprKind::Call(f, _) => {
let types = tcx.typeck(ex.hir_id.owner);
match types.node_type_opt(f.hir_id) {
Some(ty) => (ty, ex.span),
None => {
return;
}
if let Some(ty) = types.node_type_opt(f.hir_id) {
(ty, ex.span)
} else {
return;
}
}
hir::ExprKind::MethodCall(_, _, _, span) => {
let types = tcx.typeck(ex.hir_id.owner);
let def_id = types.type_dependent_def_id(ex.hir_id).unwrap();
let def_id = if let Some(def_id) = types.type_dependent_def_id(ex.hir_id) {
def_id
} else {
return;
};
(tcx.type_of(def_id), span)
}
_ => {