about summary refs log tree commit diff
path: root/compiler/rustc_save_analysis/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-10-27 01:36:12 +0000
committerbors <bors@rust-lang.org>2020-10-27 01:36:12 +0000
commit28f03ac4c08fc7ec62428d0b914e1510ce7ee2cb (patch)
treec3f0b0308ea3548fd1319b0721d9d90b4f17d0d3 /compiler/rustc_save_analysis/src/lib.rs
parenta4d30a7b490065f0aa56f58e508a11546445aea9 (diff)
parent4236d27c9bb0af5cbdfaaa840b211827c65fb1ee (diff)
Auto merge of #78421 - JohnTitor:rollup-bq2d7fo, r=JohnTitor
Rollup of 16 pull requests

Successful merges:

 - #76635 (Add [T]::as_chunks(_mut))
 - #77703 (add system-llvm-libunwind config option)
 - #78219 (Prefer to use `print_def_path`)
 - #78298 (Add test for bad NLL higher-ranked subtype)
 - #78332 (Update description for error E0308)
 - #78342 (Use check-pass in single-use-lifetime ui tests)
 - #78347 (Add lexicographical comparison doc)
 - #78348 (Make some functions private that don't have to be public)
 - #78349 (Use its own `TypeckResults` to avoid ICE)
 - #78375 (Use ? in core/std macros)
 - #78377 (Fix typo in debug statement)
 - #78388 (Add some regression tests)
 - #78394 (fix(docs): typo in BufWriter documentation)
 - #78396 (Add compiler support for LLVM's x86_64 ERMSB feature)
 - #78405 (Fix typo in lint description)
 - #78412 (Improve formatting of hash collections docs)

Failed merges:

r? `@ghost`
Diffstat (limited to 'compiler/rustc_save_analysis/src/lib.rs')
-rw-r--r--compiler/rustc_save_analysis/src/lib.rs11
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 {