Skip to content

Commit f1150ba

Browse files
committed
Revert "Rollup merge of #80637 - LingMan:filter, r=oli-obk"
This reverts commit faf8bed, reversing changes made to 1c6593c.
1 parent 68ec332 commit f1150ba

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,22 @@ impl<'a, 'tcx> FindHirNodeVisitor<'a, 'tcx> {
4343
}
4444

4545
fn node_ty_contains_target(&mut self, hir_id: HirId) -> Option<Ty<'tcx>> {
46-
self.infcx
46+
let ty_opt = self
47+
.infcx
4748
.in_progress_typeck_results
48-
.and_then(|typeck_results| typeck_results.borrow().node_type_opt(hir_id))
49-
.map(|ty| self.infcx.resolve_vars_if_possible(ty))
50-
.filter(|ty| {
51-
ty.walk().any(|inner| {
49+
.and_then(|typeck_results| typeck_results.borrow().node_type_opt(hir_id));
50+
match ty_opt {
51+
Some(ty) => {
52+
let ty = self.infcx.resolve_vars_if_possible(ty);
53+
if ty.walk().any(|inner| {
5254
inner == self.target
5355
|| match (inner.unpack(), self.target.unpack()) {
5456
(GenericArgKind::Type(inner_ty), GenericArgKind::Type(target_ty)) => {
55-
use ty::{Infer, TyVar};
5657
match (inner_ty.kind(), target_ty.kind()) {
57-
(&Infer(TyVar(a_vid)), &Infer(TyVar(b_vid))) => self
58+
(
59+
&ty::Infer(ty::TyVar(a_vid)),
60+
&ty::Infer(ty::TyVar(b_vid)),
61+
) => self
5862
.infcx
5963
.inner
6064
.borrow_mut()
@@ -65,8 +69,14 @@ impl<'a, 'tcx> FindHirNodeVisitor<'a, 'tcx> {
6569
}
6670
_ => false,
6771
}
68-
})
69-
})
72+
}) {
73+
Some(ty)
74+
} else {
75+
None
76+
}
77+
}
78+
None => None,
79+
}
7080
}
7181
}
7282

0 commit comments

Comments
 (0)