Use its own TypeckResults
to avoid ICE
This commit is contained in:
parent
f58ffc9381
commit
88d39673d7
4 changed files with 23 additions and 4 deletions
|
@ -630,9 +630,14 @@ impl<'tcx> SaveContext<'tcx> {
|
|||
})
|
||||
| Node::Ty(&hir::Ty { kind: hir::TyKind::Path(ref qpath), .. }) => match qpath {
|
||||
hir::QPath::Resolved(_, path) => path.res,
|
||||
hir::QPath::TypeRelative(..) | hir::QPath::LangItem(..) => self
|
||||
.maybe_typeck_results
|
||||
.map_or(Res::Err, |typeck_results| typeck_results.qpath_res(qpath, hir_id)),
|
||||
hir::QPath::TypeRelative(..) | hir::QPath::LangItem(..) => {
|
||||
// #75962: `self.typeck_results` may be different from the `hir_id`'s result.
|
||||
if self.tcx.has_typeck_results(hir_id.owner.to_def_id()) {
|
||||
self.tcx.typeck(hir_id.owner).qpath_res(qpath, hir_id)
|
||||
} else {
|
||||
Res::Err
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Node::Binding(&hir::Pat {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue