Skip to content

Commit d724174

Browse files
committed
Fix more ReEmpty ICEs
1 parent 89e645a commit d724174

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs

+6
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
178178
a: ty::Region<'tcx>,
179179
b: ty::Region<'tcx>,
180180
) {
181+
if let ty::ReEmpty = a {
182+
return;
183+
}
181184
let b = self.to_region_vid(b);
182185
let a = self.to_region_vid(a);
183186
self.add_outlives(b, a);
@@ -190,6 +193,9 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
190193
a: ty::Region<'tcx>,
191194
bound: VerifyBound<'tcx>,
192195
) {
196+
if let ty::ReEmpty = a {
197+
return;
198+
}
193199
let type_test = self.verify_to_type_test(kind, a, bound);
194200
self.add_type_test(type_test);
195201
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Regression test for #65553
2+
//
3+
// `D::Error:` is lowered to `D::Error: ReEmpty` - check that we don't ICE in
4+
// NLL for the unexpected region.
5+
6+
// check-pass
7+
8+
trait Deserializer {
9+
type Error;
10+
}
11+
12+
fn d1<D: Deserializer>() where D::Error: {}
13+
14+
fn d2<D: Deserializer>() {
15+
d1::<D>();
16+
}
17+
18+
fn main() {}

src/test/ui/nll/empty-type-predicate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// `dyn T:` is lowered to `dyn T: ReEmpty` - check that we don't ICE in NLL for
44
// the unexpected region.
55

6-
// build-pass (FIXME(62277): could be check-pass?)
6+
// check-pass
77

88
trait T {}
99
fn f() where dyn T: {}
1010

11-
fn main() {}
11+
fn main() { f(); }

0 commit comments

Comments
 (0)