diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-25 18:33:13 +0900 |
|---|---|---|
| committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-25 18:35:24 +0900 |
| commit | 88d39673d7147af0d33705ffe06a83876e70aa2d (patch) | |
| tree | 0e28b4ee4abc091348819c7e8a546f00e42b5bcd /compiler/rustc_save_analysis/src/lib.rs | |
| parent | f58ffc93815f76576eb56df4bdeec2fe8f12b766 (diff) | |
| download | rust-88d39673d7147af0d33705ffe06a83876e70aa2d.tar.gz rust-88d39673d7147af0d33705ffe06a83876e70aa2d.zip | |
Use its own `TypeckResults` to avoid ICE
Diffstat (limited to 'compiler/rustc_save_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_save_analysis/src/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index f6434689fec..48d15370ee3 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -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 { |
