Do not attempt to write ty::Err
on binding that isn't from current HIR Owner
Fix #123009.
This commit is contained in:
parent
399fa2f6e4
commit
d54e9833e3
3 changed files with 46 additions and 10 deletions
|
@ -1916,18 +1916,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
pat: &'tcx hir::Pat<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) {
|
||||
struct V<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
struct V {
|
||||
pat_hir_ids: Vec<hir::HirId>,
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for V<'tcx> {
|
||||
type NestedFilter = rustc_middle::hir::nested_filter::All;
|
||||
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
self.tcx.hir()
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for V {
|
||||
fn visit_pat(&mut self, p: &'tcx hir::Pat<'tcx>) {
|
||||
self.pat_hir_ids.push(p.hir_id);
|
||||
hir::intravisit::walk_pat(self, p);
|
||||
|
@ -1938,7 +1931,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
let err = Ty::new_error(self.tcx, guar);
|
||||
self.write_ty(hir_id, err);
|
||||
self.write_ty(pat.hir_id, err);
|
||||
let mut visitor = V { tcx: self.tcx, pat_hir_ids: vec![] };
|
||||
let mut visitor = V { pat_hir_ids: vec![] };
|
||||
hir::intravisit::walk_pat(&mut visitor, pat);
|
||||
// Mark all the subpatterns as `{type error}` as well. This allows errors for specific
|
||||
// subpatterns to be silenced.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue