Skip to content

Commit 10743f0

Browse files
authored
Rollup merge of #90611 - fee1-dead:rustdoc-ice-fix, r=jyn514,willcrichton
Fix another ICE in rustdoc scrape_examples This has occurred to me when documenting a crate with the arguments. Not sure what could have caused it. r? `@willcrichton`
2 parents 6d246f0 + 9c14d82 commit 10743f0

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/librustdoc/scrape_examples.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,21 @@ 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+
trace!("node_type_opt({}) = None", f.hir_id);
149+
return;
150150
}
151151
}
152152
hir::ExprKind::MethodCall(_, _, _, span) => {
153153
let types = tcx.typeck(ex.hir_id.owner);
154-
let def_id = types.type_dependent_def_id(ex.hir_id).unwrap();
154+
let def_id = if let Some(def_id) = types.type_dependent_def_id(ex.hir_id) {
155+
def_id
156+
} else {
157+
trace!("type_dependent_def_id({}) = None", ex.hir_id);
158+
return;
159+
};
155160
(tcx.type_of(def_id), span)
156161
}
157162
_ => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// compile-flags: -Z unstable-options --scrape-examples-output-path t.calls --scrape-examples-target-crate foobar
2+
// check-pass
3+
#![no_std]
4+
use core as _;

0 commit comments

Comments
 (0)