about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorJack Huey <31162821+jackh726@users.noreply.github.com>2022-05-21 12:45:44 -0400
committerJack Huey <31162821+jackh726@users.noreply.github.com>2022-05-22 15:21:26 -0400
commitdc435ee762b0f46dba84e67798c8a2f0ab394091 (patch)
treeda6a59d0f86d762d61321287d79b55e913cacae3 /src/test
parent0a437b2ca081bc12425a3318cb66aade9824cbae (diff)
downloadrust-dc435ee762b0f46dba84e67798c8a2f0ab394091.tar.gz
rust-dc435ee762b0f46dba84e67798c8a2f0ab394091.zip
For hr-subtype test, use check-pass instead of rustc_error and split nll differences to separate test
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/hr-subtype/hr-subtype-nll.bound_a_b_ret_a_vs_bound_a_ret_a.stderr (renamed from src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.nll.stderr)2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype-nll.bound_a_vs_free_x.stderr (renamed from src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.nll.stderr)2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype-nll.bound_inv_a_b_vs_bound_inv_a.stderr (renamed from src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.nll.stderr)4
-rw-r--r--src/test/ui/hr-subtype/hr-subtype-nll.free_inv_x_vs_free_inv_y.stderr (renamed from src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr)4
-rw-r--r--src/test/ui/hr-subtype/hr-subtype-nll.free_x_vs_free_y.stderr (renamed from src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr)2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype-nll.rs117
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr2
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr12
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr8
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr6
-rw-r--r--src/test/ui/hr-subtype/hr-subtype.rs29
-rw-r--r--src/test/ui/hr-subtype/placeholder-pattern-fail.base.stderr (renamed from src/test/ui/hr-subtype/placeholder-pattern-fail.stderr)10
-rw-r--r--src/test/ui/hr-subtype/placeholder-pattern-fail.nll.stderr2
-rw-r--r--src/test/ui/hr-subtype/placeholder-pattern-fail.rs8
24 files changed, 164 insertions, 112 deletions
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.nll.stderr b/src/test/ui/hr-subtype/hr-subtype-nll.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
index 87d826021b7..3edb1064e3e 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype-nll.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:13
+  --> $DIR/hr-subtype-nll.rs:60:13
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.nll.stderr b/src/test/ui/hr-subtype/hr-subtype-nll.bound_a_vs_free_x.stderr
index bd97f6f0906..f02eeea90bf 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype-nll.bound_a_vs_free_x.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:13
+  --> $DIR/hr-subtype-nll.rs:60:13
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.nll.stderr b/src/test/ui/hr-subtype/hr-subtype-nll.bound_inv_a_b_vs_bound_inv_a.stderr
index 874909bf486..bfc9793fe5d 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype-nll.bound_inv_a_b_vs_bound_inv_a.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:13
+  --> $DIR/hr-subtype-nll.rs:60:13
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
@@ -13,7 +13,7 @@ LL | | for<'a>    fn(Inv<'a>, Inv<'a>)) }
    = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:13
+  --> $DIR/hr-subtype-nll.rs:60:13
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype-nll.free_inv_x_vs_free_inv_y.stderr
index f5db68e8be1..ee0dc877fd1 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype-nll.free_inv_x_vs_free_inv_y.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/hr-subtype.rs:39:13
+  --> $DIR/hr-subtype-nll.rs:54:13
    |
 LL |           fn subtype<'x, 'y: 'x, 'z: 'y>() {
    |                      --  -- lifetime `'y` defined here
@@ -19,7 +19,7 @@ LL | | fn(Inv<'y>)) }
    = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: lifetime may not live long enough
-  --> $DIR/hr-subtype.rs:45:13
+  --> $DIR/hr-subtype-nll.rs:60:13
    |
 LL |           fn supertype<'x, 'y: 'x, 'z: 'y>() {
    |                        --  -- lifetime `'y` defined here
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype-nll.free_x_vs_free_y.stderr
index ab97481824d..75904d6df99 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype-nll.free_x_vs_free_y.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/hr-subtype.rs:45:13
+  --> $DIR/hr-subtype-nll.rs:60:13
    |
 LL |           fn supertype<'x, 'y: 'x, 'z: 'y>() {
    |                        --  -- lifetime `'y` defined here
diff --git a/src/test/ui/hr-subtype/hr-subtype-nll.rs b/src/test/ui/hr-subtype/hr-subtype-nll.rs
new file mode 100644
index 00000000000..7fc1692b350
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype-nll.rs
@@ -0,0 +1,117 @@
+// Targeted tests for the higher-ranked subtyping code.
+
+#![allow(dead_code)]
+
+// revisions: bound_a_vs_bound_a
+// revisions: bound_a_vs_bound_b
+// revisions: bound_inv_a_vs_bound_inv_b
+// revisions: bound_co_a_vs_bound_co_b
+// revisions: bound_a_vs_free_x
+// revisions: free_x_vs_free_x
+// revisions: free_x_vs_free_y
+// revisions: free_inv_x_vs_free_inv_y
+// revisions: bound_a_b_vs_bound_a
+// revisions: bound_co_a_b_vs_bound_co_a
+// revisions: bound_contra_a_contra_b_ret_co_a
+// revisions: bound_co_a_co_b_ret_contra_a
+// revisions: bound_inv_a_b_vs_bound_inv_a
+// revisions: bound_a_b_ret_a_vs_bound_a_ret_a
+
+//[bound_a_vs_bound_a] check-pass
+//[bound_a_vs_bound_b] check-pass
+//[bound_inv_a_vs_bound_inv_b] check-pass
+//[bound_co_a_vs_bound_co_b] check-pass
+//[free_x_vs_free_x] check-pass
+//[bound_co_a_b_vs_bound_co_a] check-pass
+//[bound_co_a_co_b_ret_contra_a] check-pass
+//[bound_a_b_vs_bound_a] check-pass
+//[bound_contra_a_contra_b_ret_co_a] check-pass
+
+// compile-flags: -Z borrowck=mir
+// ignore-compare-mode-nll
+// FIXME(nll): When stabilizing, this test should be replace with `hr-subtype.rs`
+// The two would normally be just revisions, but this test uses revisions heavily, so splitting into
+// a separate test is just easier.
+
+fn gimme<T>(_: Option<T>) {}
+
+struct Inv<'a> {
+    x: *mut &'a u32,
+}
+
+struct Co<'a> {
+    x: fn(&'a u32),
+}
+
+struct Contra<'a> {
+    x: &'a u32,
+}
+
+macro_rules! check {
+    ($rev:ident: ($t1:ty, $t2:ty)) => {
+        #[cfg($rev)]
+        fn subtype<'x, 'y: 'x, 'z: 'y>() {
+            gimme::<$t2>(None::<$t1>);
+            //[free_inv_x_vs_free_inv_y]~^ ERROR
+        }
+
+        #[cfg($rev)]
+        fn supertype<'x, 'y: 'x, 'z: 'y>() {
+            gimme::<$t1>(None::<$t2>);
+            //[bound_a_vs_free_x]~^ ERROR
+            //[free_x_vs_free_y]~^^ ERROR
+            //[bound_inv_a_b_vs_bound_inv_a]~^^^ ERROR
+            //[bound_inv_a_b_vs_bound_inv_a]~| ERROR
+            //[bound_a_b_ret_a_vs_bound_a_ret_a]~^^^^^ ERROR
+            //[free_inv_x_vs_free_inv_y]~^^^^^^ ERROR
+        }
+    };
+}
+
+// If both have bound regions, they are equivalent, regardless of
+// variant.
+check! { bound_a_vs_bound_a: (for<'a> fn(&'a u32),
+for<'a> fn(&'a u32)) }
+check! { bound_a_vs_bound_b: (for<'a> fn(&'a u32),
+for<'b> fn(&'b u32)) }
+check! { bound_inv_a_vs_bound_inv_b: (for<'a> fn(Inv<'a>),
+for<'b> fn(Inv<'b>)) }
+check! { bound_co_a_vs_bound_co_b: (for<'a> fn(Co<'a>),
+for<'b> fn(Co<'b>)) }
+
+// Bound is a subtype of free.
+check! { bound_a_vs_free_x: (for<'a> fn(&'a u32),
+fn(&'x u32)) }
+
+// Two free regions are relatable if subtyping holds.
+check! { free_x_vs_free_x: (fn(&'x u32),
+fn(&'x u32)) }
+check! { free_x_vs_free_y: (fn(&'x u32),
+fn(&'y u32)) }
+check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+fn(Inv<'y>)) }
+
+// Somewhat surprisingly, a fn taking two distinct bound lifetimes and
+// a fn taking one bound lifetime can be interchangeable, but only if
+// we are co- or contra-variant with respect to both lifetimes.
+//
+// The reason is:
+// - if we are covariant, then 'a and 'b can be set to the call-site
+//   intersection;
+// - if we are contravariant, then 'a can be inferred to 'static.
+check! { bound_a_b_vs_bound_a: (for<'a,'b> fn(&'a u32, &'b u32),
+for<'a>    fn(&'a u32, &'a u32)) }
+check! { bound_co_a_b_vs_bound_co_a: (for<'a,'b> fn(Co<'a>, Co<'b>),
+for<'a>    fn(Co<'a>, Co<'a>)) }
+check! { bound_contra_a_contra_b_ret_co_a: (for<'a,'b> fn(Contra<'a>, Contra<'b>) -> Co<'a>,
+for<'a>    fn(Contra<'a>, Contra<'a>) -> Co<'a>) }
+check! { bound_co_a_co_b_ret_contra_a: (for<'a,'b> fn(Co<'a>, Co<'b>) -> Contra<'a>,
+for<'a>    fn(Co<'a>, Co<'a>) -> Contra<'a>) }
+
+// If we make those lifetimes invariant, then the two types are not interchangeable.
+check! { bound_inv_a_b_vs_bound_inv_a: (for<'a,'b> fn(Inv<'a>, Inv<'b>),
+for<'a>    fn(Inv<'a>, Inv<'a>)) }
+check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &'a u32,
+for<'a>    fn(&'a u32, &'a u32) -> &'a u32) }
+
+fn main() {}
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
index 91bd0b6929a..13e9fa8a894 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:26
+  --> $DIR/hr-subtype.rs:59:26
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |                            ^^^^^^^^^^^ one type is more general than the other
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
index 27ce56fc16a..b66ff5a392e 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:26
+  --> $DIR/hr-subtype.rs:59:26
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |                            ^^^^^^^^^^^ one type is more general than the other
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
index bb20f81a1de..fa715fd354e 100644
--- a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:26
+  --> $DIR/hr-subtype.rs:59:26
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |                            ^^^^^^^^^^^ one type is more general than the other
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
index 9f200357222..377689603aa 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:39:26
+  --> $DIR/hr-subtype.rs:53:26
    |
 LL |               gimme::<$t2>(None::<$t1>);
    |                            ^^^^^^^^^^^ lifetime mismatch
@@ -11,7 +11,7 @@ LL | | fn(Inv<'y>)) }
    = note: expected enum `Option<fn(Inv<'y>)>`
               found enum `Option<fn(Inv<'x>)>`
 note: the lifetime `'x` as defined here...
-  --> $DIR/hr-subtype.rs:38:20
+  --> $DIR/hr-subtype.rs:52:20
    |
 LL |           fn subtype<'x, 'y: 'x, 'z: 'y>() {
    |                      ^^
@@ -20,7 +20,7 @@ LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
 LL | | fn(Inv<'y>)) }
    | |______________- in this macro invocation
 note: ...does not necessarily outlive the lifetime `'y` as defined here
-  --> $DIR/hr-subtype.rs:38:24
+  --> $DIR/hr-subtype.rs:52:24
    |
 LL |           fn subtype<'x, 'y: 'x, 'z: 'y>() {
    |                          ^^
@@ -31,7 +31,7 @@ LL | | fn(Inv<'y>)) }
    = note: this error originates in the macro `check` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:26
+  --> $DIR/hr-subtype.rs:59:26
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |                            ^^^^^^^^^^^ lifetime mismatch
@@ -43,7 +43,7 @@ LL | | fn(Inv<'y>)) }
    = note: expected enum `Option<fn(Inv<'x>)>`
               found enum `Option<fn(Inv<'y>)>`
 note: the lifetime `'x` as defined here...
-  --> $DIR/hr-subtype.rs:44:22
+  --> $DIR/hr-subtype.rs:58:22
    |
 LL |           fn supertype<'x, 'y: 'x, 'z: 'y>() {
    |                        ^^
@@ -52,7 +52,7 @@ LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
 LL | | fn(Inv<'y>)) }
    | |______________- in this macro invocation
 note: ...does not necessarily outlive the lifetime `'y` as defined here
-  --> $DIR/hr-subtype.rs:44:26
+  --> $DIR/hr-subtype.rs:58:26
    |
 LL |           fn supertype<'x, 'y: 'x, 'z: 'y>() {
    |                            ^^
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr
deleted file mode 100644
index 2bf78d12290..00000000000
--- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fatal error triggered by #[rustc_error]
-  --> $DIR/hr-subtype.rs:102:1
-   |
-LL | fn main() {
-   | ^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
index 07add3d91a0..9e5eb972f47 100644
--- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
+++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/hr-subtype.rs:45:26
+  --> $DIR/hr-subtype.rs:59:26
    |
 LL |               gimme::<$t1>(None::<$t2>);
    |                            ^^^^^^^^^^^ lifetime mismatch
@@ -11,7 +11,7 @@ LL | | fn(&'y u32)) }
    = note: expected enum `Option<fn(&'x u32)>`
               found enum `Option<fn(&'y u32)>`
 note: the lifetime `'x` as defined here...
-  --> $DIR/hr-subtype.rs:44:22
+  --> $DIR/hr-subtype.rs:58:22
    |
 LL |           fn supertype<'x, 'y: 'x, 'z: 'y>() {
    |                        ^^
@@ -20,7 +20,7 @@ LL | / check! { free_x_vs_free_y: (fn(&'x u32),
 LL | | fn(&'y u32)) }
    | |______________- in this macro invocation
 note: ...does not necessarily outlive the lifetime `'y` as defined here
-  --> $DIR/hr-subtype.rs:44:26
+  --> $DIR/hr-subtype.rs:58:26
    |
 LL |           fn supertype<'x, 'y: 'x, 'z: 'y>() {
    |                            ^^
diff --git a/src/test/ui/hr-subtype/hr-subtype.rs b/src/test/ui/hr-subtype/hr-subtype.rs
index ad9500eedca..33929cdb868 100644
--- a/src/test/ui/hr-subtype/hr-subtype.rs
+++ b/src/test/ui/hr-subtype/hr-subtype.rs
@@ -1,6 +1,5 @@
 // Targeted tests for the higher-ranked subtyping code.
 
-#![feature(rustc_attrs)]
 #![allow(dead_code)]
 
 // revisions: bound_a_vs_bound_a
@@ -18,6 +17,21 @@
 // revisions: bound_inv_a_b_vs_bound_inv_a
 // revisions: bound_a_b_ret_a_vs_bound_a_ret_a
 
+//[bound_a_vs_bound_a] check-pass
+//[bound_a_vs_bound_b] check-pass
+//[bound_inv_a_vs_bound_inv_b] check-pass
+//[bound_co_a_vs_bound_co_b] check-pass
+//[free_x_vs_free_x] check-pass
+//[bound_co_a_b_vs_bound_co_a] check-pass
+//[bound_co_a_co_b_ret_contra_a] check-pass
+//[bound_a_b_vs_bound_a] check-pass
+//[bound_contra_a_contra_b_ret_co_a] check-pass
+
+// ignore-compare-mode-nll
+// FIXME(nll): When stabilizing, this test should be replaced with `hr-subtype-nll.rs`
+// The two would normally be just revisions, but this test uses revisions heavily, so splitting into
+// a separate test is just easier.
+
 fn gimme<T>(_: Option<T>) {}
 
 struct Inv<'a> {
@@ -98,15 +112,4 @@ for<'a>    fn(Inv<'a>, Inv<'a>)) }
 check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &'a u32,
 for<'a>    fn(&'a u32, &'a u32) -> &'a u32) }
 
-#[rustc_error]
-fn main() {
-    //[bound_a_vs_bound_a]~^ ERROR fatal error triggered by #[rustc_error]
-    //[bound_a_vs_bound_b]~^^ ERROR fatal error triggered by #[rustc_error]
-    //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR fatal error triggered by #[rustc_error]
-    //[bound_co_a_vs_bound_co_b]~^^^^ ERROR fatal error triggered by #[rustc_error]
-    //[free_x_vs_free_x]~^^^^^ ERROR fatal error triggered by #[rustc_error]
-    //[bound_co_a_b_vs_bound_co_a]~^^^^^^ ERROR
-    //[bound_co_a_co_b_ret_contra_a]~^^^^^^^ ERROR
-    //[bound_a_b_vs_bound_a]~^^^^^^^^ ERROR
-    //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR
-}
+fn main() {}
diff --git a/src/test/ui/hr-subtype/placeholder-pattern-fail.stderr b/src/test/ui/hr-subtype/placeholder-pattern-fail.base.stderr
index 7bd5308052b..c6cb77d8d8d 100644
--- a/src/test/ui/hr-subtype/placeholder-pattern-fail.stderr
+++ b/src/test/ui/hr-subtype/placeholder-pattern-fail.base.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/placeholder-pattern-fail.rs:9:47
+  --> $DIR/placeholder-pattern-fail.rs:13:47
    |
 LL |     let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub;
    |                                               ^^^ one type is more general than the other
@@ -8,7 +8,7 @@ LL |     let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub;
               found fn pointer `for<'a> fn(Inv<'a>, Inv<'a>)`
 
 error[E0308]: mismatched types
-  --> $DIR/placeholder-pattern-fail.rs:14:31
+  --> $DIR/placeholder-pattern-fail.rs:18:31
    |
 LL |     let _x: (&'static i32,) = x;
    |                               ^ lifetime mismatch
@@ -16,14 +16,14 @@ LL |     let _x: (&'static i32,) = x;
    = note: expected tuple `(&'static i32,)`
               found tuple `(&'c i32,)`
 note: the lifetime `'c` as defined here...
-  --> $DIR/placeholder-pattern-fail.rs:13:12
+  --> $DIR/placeholder-pattern-fail.rs:17:12
    |
 LL | fn simple1<'c>(x: (&'c i32,)) {
    |            ^^
    = note: ...does not necessarily outlive the static lifetime
 
 error[E0308]: mismatched types
-  --> $DIR/placeholder-pattern-fail.rs:19:30
+  --> $DIR/placeholder-pattern-fail.rs:23:30
    |
 LL |     let _: (&'static i32,) = x;
    |                              ^ lifetime mismatch
@@ -31,7 +31,7 @@ LL |     let _: (&'static i32,) = x;
    = note: expected tuple `(&'static i32,)`
               found tuple `(&'c i32,)`
 note: the lifetime `'c` as defined here...
-  --> $DIR/placeholder-pattern-fail.rs:18:12
+  --> $DIR/placeholder-pattern-fail.rs:22:12
    |
 LL | fn simple2<'c>(x: (&'c i32,)) {
    |            ^^
diff --git a/src/test/ui/hr-subtype/placeholder-pattern-fail.nll.stderr b/src/test/ui/hr-subtype/placeholder-pattern-fail.nll.stderr
index 73b0a317364..a1f713d8afb 100644
--- a/src/test/ui/hr-subtype/placeholder-pattern-fail.nll.stderr
+++ b/src/test/ui/hr-subtype/placeholder-pattern-fail.nll.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/placeholder-pattern-fail.rs:9:47
+  --> $DIR/placeholder-pattern-fail.rs:13:47
    |
 LL |     let _: for<'a, 'b> fn(Inv<'a>, Inv<'b>) = sub;
    |                                               ^^^ one type is more general than the other
diff --git a/src/test/ui/hr-subtype/placeholder-pattern-fail.rs b/src/test/ui/hr-subtype/placeholder-pattern-fail.rs
index 3b5b075cb58..ac276a88982 100644
--- a/src/test/ui/hr-subtype/placeholder-pattern-fail.rs
+++ b/src/test/ui/hr-subtype/placeholder-pattern-fail.rs
@@ -1,3 +1,7 @@
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 // Check that incorrect higher ranked subtyping
 // causes an error.
 struct Inv<'a>(fn(&'a ()) -> &'a ());
@@ -12,12 +16,12 @@ fn hr_subtype<'c>(f: for<'a, 'b> fn(Inv<'a>, Inv<'a>)) {
 
 fn simple1<'c>(x: (&'c i32,)) {
     let _x: (&'static i32,) = x;
-    //~^ ERROR mismatched types
+    //[base]~^ ERROR mismatched types
 }
 
 fn simple2<'c>(x: (&'c i32,)) {
     let _: (&'static i32,) = x;
-    //~^ ERROR mismatched types
+    //[base]~^ ERROR mismatched types
 }
 
 fn main() {