Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco
Use its own `TypeckResults` to avoid ICE Fixes #75962
This commit is contained in:
commit
6abd2a59e7
5 changed files with 26 additions and 7 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 {
|
||||
|
|
|
@ -262,7 +262,7 @@ impl<'hir> Sig for hir::Ty<'hir> {
|
|||
} else {
|
||||
let start = offset + prefix.len() + 5;
|
||||
let end = start + name.len();
|
||||
// FIXME should put the proper path in there, not elipses.
|
||||
// FIXME should put the proper path in there, not ellipsis.
|
||||
Ok(Signature {
|
||||
text: prefix + "...::" + &name,
|
||||
defs: vec![],
|
||||
|
@ -272,7 +272,7 @@ impl<'hir> Sig for hir::Ty<'hir> {
|
|||
}
|
||||
hir::TyKind::Path(hir::QPath::TypeRelative(ty, segment)) => {
|
||||
let nested_ty = ty.make(offset + 1, id, scx)?;
|
||||
let prefix = format!("<{}>::", nested_ty.text,);
|
||||
let prefix = format!("<{}>::", nested_ty.text);
|
||||
|
||||
let name = path_segment_to_string(segment);
|
||||
let res = scx.get_path_res(id.ok_or("Missing id for Path")?);
|
||||
|
@ -551,7 +551,7 @@ impl<'hir> Sig for hir::Item<'hir> {
|
|||
// FIXME where clause
|
||||
}
|
||||
hir::ItemKind::ForeignMod(_) => Err("extern mod"),
|
||||
hir::ItemKind::GlobalAsm(_) => Err("glboal asm"),
|
||||
hir::ItemKind::GlobalAsm(_) => Err("global asm"),
|
||||
hir::ItemKind::ExternCrate(_) => Err("extern crate"),
|
||||
hir::ItemKind::OpaqueTy(..) => Err("opaque type"),
|
||||
// FIXME should implement this (e.g., pub use).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue