Skip to content

Commit a5c0525

Browse files
authored
Revert "lub: don't bail out due to empty binders"
1 parent 116edb6 commit a5c0525

File tree

6 files changed

+12
-209
lines changed

6 files changed

+12
-209
lines changed

compiler/rustc_infer/src/infer/glb.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,12 @@ impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
9595
T: Relate<'tcx>,
9696
{
9797
debug!("binders(a={:?}, b={:?})", a, b);
98-
if a.skip_binder().has_escaping_bound_vars() || b.skip_binder().has_escaping_bound_vars() {
99-
// When higher-ranked types are involved, computing the GLB is
100-
// very challenging, switch to invariance. This is obviously
101-
// overly conservative but works ok in practice.
102-
self.relate_with_variance(
103-
ty::Variance::Invariant,
104-
ty::VarianceDiagInfo::default(),
105-
a,
106-
b,
107-
)?;
108-
Ok(a)
109-
} else {
110-
Ok(ty::Binder::dummy(self.relate(a.skip_binder(), b.skip_binder())?))
111-
}
98+
99+
// When higher-ranked types are involved, computing the LUB is
100+
// very challenging, switch to invariance. This is obviously
101+
// overly conservative but works ok in practice.
102+
self.relate_with_variance(ty::Variance::Invariant, ty::VarianceDiagInfo::default(), a, b)?;
103+
Ok(a)
112104
}
113105
}
114106

compiler/rustc_infer/src/infer/lub.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,12 @@ impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
9595
T: Relate<'tcx>,
9696
{
9797
debug!("binders(a={:?}, b={:?})", a, b);
98-
if a.skip_binder().has_escaping_bound_vars() || b.skip_binder().has_escaping_bound_vars() {
99-
// When higher-ranked types are involved, computing the LUB is
100-
// very challenging, switch to invariance. This is obviously
101-
// overly conservative but works ok in practice.
102-
self.relate_with_variance(
103-
ty::Variance::Invariant,
104-
ty::VarianceDiagInfo::default(),
105-
a,
106-
b,
107-
)?;
108-
Ok(a)
109-
} else {
110-
Ok(ty::Binder::dummy(self.relate(a.skip_binder(), b.skip_binder())?))
111-
}
98+
99+
// When higher-ranked types are involved, computing the LUB is
100+
// very challenging, switch to invariance. This is obviously
101+
// overly conservative but works ok in practice.
102+
self.relate_with_variance(ty::Variance::Invariant, ty::VarianceDiagInfo::default(), a, b)?;
103+
Ok(a)
112104
}
113105
}
114106

src/test/ui/lub-glb/empty-binder-future-compat.rs

-22
This file was deleted.

src/test/ui/lub-glb/empty-binders-err.rs

-55
This file was deleted.

src/test/ui/lub-glb/empty-binders-err.stderr

-59
This file was deleted.

src/test/ui/lub-glb/empty-binders.rs

-45
This file was deleted.

0 commit comments

Comments
 (0)