Skip to content

Commit

Permalink
Revert "Rollup merge of rust-lang#80637 - LingMan:filter, r=oli-obk"
Browse files Browse the repository at this point in the history
This reverts commit faf8bed, reversing
changes made to 1c6593c.
  • Loading branch information
rylev committed Jan 5, 2021
1 parent 68ec332 commit f1150ba
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ impl<'a, 'tcx> FindHirNodeVisitor<'a, 'tcx> {
}

fn node_ty_contains_target(&mut self, hir_id: HirId) -> Option<Ty<'tcx>> {
self.infcx
let ty_opt = self
.infcx
.in_progress_typeck_results
.and_then(|typeck_results| typeck_results.borrow().node_type_opt(hir_id))
.map(|ty| self.infcx.resolve_vars_if_possible(ty))
.filter(|ty| {
ty.walk().any(|inner| {
.and_then(|typeck_results| typeck_results.borrow().node_type_opt(hir_id));
match ty_opt {
Some(ty) => {
let ty = self.infcx.resolve_vars_if_possible(ty);
if ty.walk().any(|inner| {
inner == self.target
|| match (inner.unpack(), self.target.unpack()) {
(GenericArgKind::Type(inner_ty), GenericArgKind::Type(target_ty)) => {
use ty::{Infer, TyVar};
match (inner_ty.kind(), target_ty.kind()) {
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => self
(
&ty::Infer(ty::TyVar(a_vid)),
&ty::Infer(ty::TyVar(b_vid)),
) => self
.infcx
.inner
.borrow_mut()
Expand All @@ -65,8 +69,14 @@ impl<'a, 'tcx> FindHirNodeVisitor<'a, 'tcx> {
}
_ => false,
}
})
})
}) {
Some(ty)
} else {
None
}
}
None => None,
}
}
}

Expand Down

0 comments on commit f1150ba

Please sign in to comment.