about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-10-20 22:08:44 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2019-10-24 21:15:08 +0100
commitd72417434682e1fcb6e447436f0664d7ea763468 (patch)
tree1025f71ba35a49e55e303643b48e8c265ca3e8c9
parent89e645ace853d86e8c0002247482eac9073c90fd (diff)
downloadrust-d72417434682e1fcb6e447436f0664d7ea763468.tar.gz
rust-d72417434682e1fcb6e447436f0664d7ea763468.zip
Fix more `ReEmpty` ICEs
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs6
-rw-r--r--src/test/ui/nll/empty-type-predicate-2.rs18
-rw-r--r--src/test/ui/nll/empty-type-predicate.rs4
3 files changed, 26 insertions, 2 deletions
diff --git a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
index c88f1cac350..34ac96beb5c 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
@@ -178,6 +178,9 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
         a: ty::Region<'tcx>,
         b: ty::Region<'tcx>,
     ) {
+        if let ty::ReEmpty = a {
+            return;
+        }
         let b = self.to_region_vid(b);
         let a = self.to_region_vid(a);
         self.add_outlives(b, a);
@@ -190,6 +193,9 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
         a: ty::Region<'tcx>,
         bound: VerifyBound<'tcx>,
     ) {
+        if let ty::ReEmpty = a {
+            return;
+        }
         let type_test = self.verify_to_type_test(kind, a, bound);
         self.add_type_test(type_test);
     }
diff --git a/src/test/ui/nll/empty-type-predicate-2.rs b/src/test/ui/nll/empty-type-predicate-2.rs
new file mode 100644
index 00000000000..20d6e47f753
--- /dev/null
+++ b/src/test/ui/nll/empty-type-predicate-2.rs
@@ -0,0 +1,18 @@
+// Regression test for #65553
+//
+// `D::Error:` is lowered to `D::Error: ReEmpty` - check that we don't ICE in
+// NLL for the unexpected region.
+
+// check-pass
+
+trait Deserializer {
+    type Error;
+}
+
+fn d1<D: Deserializer>() where D::Error: {}
+
+fn d2<D: Deserializer>() {
+    d1::<D>();
+}
+
+fn main() {}
diff --git a/src/test/ui/nll/empty-type-predicate.rs b/src/test/ui/nll/empty-type-predicate.rs
index 48073f8749e..d126a455dae 100644
--- a/src/test/ui/nll/empty-type-predicate.rs
+++ b/src/test/ui/nll/empty-type-predicate.rs
@@ -3,9 +3,9 @@
 // `dyn T:` is lowered to `dyn T: ReEmpty` - check that we don't ICE in NLL for
 // the unexpected region.
 
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 
 trait T {}
 fn f() where dyn T: {}
 
-fn main() {}
+fn main() { f(); }