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`
This commit is contained in:
commit
10743f0f68
@ -142,16 +142,21 @@ where
|
|||||||
hir::ExprKind::Call(f, _) => {
|
hir::ExprKind::Call(f, _) => {
|
||||||
let types = tcx.typeck(ex.hir_id.owner);
|
let types = tcx.typeck(ex.hir_id.owner);
|
||||||
|
|
||||||
match types.node_type_opt(f.hir_id) {
|
if let Some(ty) = types.node_type_opt(f.hir_id) {
|
||||||
Some(ty) => (ty, ex.span),
|
(ty, ex.span)
|
||||||
None => {
|
} else {
|
||||||
|
trace!("node_type_opt({}) = None", f.hir_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
hir::ExprKind::MethodCall(_, _, _, span) => {
|
hir::ExprKind::MethodCall(_, _, _, span) => {
|
||||||
let types = tcx.typeck(ex.hir_id.owner);
|
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 {
|
||||||
|
trace!("type_dependent_def_id({}) = None", ex.hir_id);
|
||||||
|
return;
|
||||||
|
};
|
||||||
(tcx.type_of(def_id), span)
|
(tcx.type_of(def_id), span)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
4
src/test/rustdoc-ui/scrape-examples-ice.rs
Normal file
4
src/test/rustdoc-ui/scrape-examples-ice.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// compile-flags: -Z unstable-options --scrape-examples-output-path t.calls --scrape-examples-target-crate foobar
|
||||||
|
// check-pass
|
||||||
|
#![no_std]
|
||||||
|
use core as _;
|
Loading…
x
Reference in New Issue
Block a user