about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-04-09 21:35:22 +0000
committerbors <bors@rust-lang.org>2025-04-09 21:35:22 +0000
commit51548ce71fe80b5ca7aef00e6f1bf2491df98c79 (patch)
tree29b433265de973052eb7b54582906227dad45705 /tests
parent934880f586f6ac1f952c7090e2a943fcd7775e7b (diff)
parent7aab307541051ea59bde1bb3f0375463c345b9aa (diff)
downloadrust-51548ce71fe80b5ca7aef00e6f1bf2491df98c79.tar.gz
rust-51548ce71fe80b5ca7aef00e6f1bf2491df98c79.zip
Auto merge of #139595 - matthiaskrgr:rollup-kaa8aim, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #138470 (Test interaction between RFC 2229 migration and use closures)
 - #138628 (Add more ergonomic clone tests)
 - #139164 (std: improve documentation for get_mut() methods regarding forgotten guards)
 - #139488 (Add missing regression GUI test)
 - #139489 (compiletest: Add directive `dont-require-annotations`)
 - #139513 (Report higher-ranked trait error when higher-ranked projection goal fails in new solver)
 - #139521 (triagebot: roll compiler reviewers for rustc/unstable book)
 - #139532 (Update `u8`-to-and-from-`i8` suggestions.)
 - #139551 (report call site of inlined scopes for large assignment lints)
 - #139575 (Remove redundant words)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-gui/settings.goml14
-rw-r--r--tests/ui/cfg/cfg_false_no_std-2.rs8
-rw-r--r--tests/ui/ergonomic-clones/closure/multiple-use-variants.rs35
-rw-r--r--tests/ui/ergonomic-clones/closure/multiple-use-variants.stderr13
-rw-r--r--tests/ui/ergonomic-clones/closure/rfc2229-migration.fixed26
-rw-r--r--tests/ui/ergonomic-clones/closure/rfc2229-migration.rs25
-rw-r--r--tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr27
-rw-r--r--tests/ui/ergonomic-clones/closure/spawn-thread.edition2018.stderr28
-rw-r--r--tests/ui/ergonomic-clones/closure/spawn-thread.rs50
-rw-r--r--tests/ui/ergonomic-clones/dotuse/block.rs11
-rw-r--r--tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr4
-rw-r--r--tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr26
-rw-r--r--tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs5
-rw-r--r--tests/ui/lint/large_assignments/inline_mir.rs24
-rw-r--r--tests/ui/lint/large_assignments/inline_mir.stderr15
-rw-r--r--tests/ui/mismatched_types/closure-mismatch.current.stderr (renamed from tests/ui/mismatched_types/closure-mismatch.stderr)8
-rw-r--r--tests/ui/mismatched_types/closure-mismatch.next.stderr67
-rw-r--r--tests/ui/mismatched_types/closure-mismatch.rs14
-rw-r--r--tests/ui/panic-runtime/two-panic-runtimes.rs8
-rw-r--r--tests/ui/panic-runtime/want-abort-got-unwind.rs8
-rw-r--r--tests/ui/panic-runtime/want-abort-got-unwind2.rs8
21 files changed, 373 insertions, 51 deletions
diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml
index 4ab5b83d7c4..11d3696ccf6 100644
--- a/tests/rustdoc-gui/settings.goml
+++ b/tests/rustdoc-gui/settings.goml
@@ -314,6 +314,13 @@ compare-elements-position: (".sub form", "#settings", ["x"])
 // Check that setting-line has the same margin in this mode as in the popover.
 assert-css: (".setting-line", {"margin": |setting_line_margin|})
 
+// We will check that the checkboxes size doesn't change either.
+assert-size: (
+    "#settings label > input[type='checkbox']",
+    {"width": 19, "height": 19},
+    ALL,
+)
+
 // We now check the display with JS disabled.
 assert-false: "noscript section"
 javascript: false
@@ -327,3 +334,10 @@ reload:
 set-window-size: (300, 1000)
 wait-for: "#settings"
 assert-css: (".setting-radio", {"cursor": "pointer"})
+
+// We ensure that the checkboxes size didn't change.
+assert-size: (
+    "#settings label > input[type='checkbox']",
+    {"width": 19, "height": 19},
+    ALL,
+)
diff --git a/tests/ui/cfg/cfg_false_no_std-2.rs b/tests/ui/cfg/cfg_false_no_std-2.rs
index 35e545aae34..349c49412ff 100644
--- a/tests/ui/cfg/cfg_false_no_std-2.rs
+++ b/tests/ui/cfg/cfg_false_no_std-2.rs
@@ -1,7 +1,6 @@
 // Error, the linked empty library is `no_std` and doesn't provide a panic handler.
 
-//@ compile-flags: --error-format=human
-//@ error-pattern: `#[panic_handler]` function required, but not found
+//@ dont-require-annotations:ERROR
 //@ dont-check-compiler-stderr
 //@ aux-build: cfg_false_lib_no_std_before.rs
 
@@ -11,6 +10,7 @@ extern crate cfg_false_lib_no_std_before as _;
 
 fn main() {}
 
-// FIXME: The second error is target-dependent.
-//FIXME~? ERROR `#[panic_handler]` function required, but not found
+//~? ERROR `#[panic_handler]` function required, but not found
+// FIXME: This error is target-dependent, could be served by some "optional error" annotation
+// instead of `dont-require-annotations`.
 //FIXME~? ERROR unwinding panics are not supported without std
diff --git a/tests/ui/ergonomic-clones/closure/multiple-use-variants.rs b/tests/ui/ergonomic-clones/closure/multiple-use-variants.rs
new file mode 100644
index 00000000000..e2e9820a740
--- /dev/null
+++ b/tests/ui/ergonomic-clones/closure/multiple-use-variants.rs
@@ -0,0 +1,35 @@
+#![feature(ergonomic_clones)]
+#![allow(incomplete_features)]
+
+use std::clone::UseCloned;
+
+fn takes_val<T>(_: T) {}
+fn takes_ref<'a, T>(_: &'a T) {}
+
+#[derive(Clone)]
+struct Inner<'a, T>(&'a T);
+
+impl<'a, T> UseCloned for Inner<'a, T> where T: Clone {}
+
+fn main() {
+    let v = String::new();
+    let inner = Inner(&v);
+
+    let _ = use || {
+        takes_ref(inner.0);
+        takes_val(inner.0)
+    };
+    let _ = use || {
+        takes_ref(inner.0);
+        takes_val(inner.0);
+        takes_val(inner.0);
+        takes_val(inner)
+    };
+    let _ = use || {
+        takes_ref(inner.0);
+        takes_val(inner.0);
+        takes_val(inner);
+        takes_val(inner)
+        //~^ ERROR: use of moved value: `inner` [E0382]
+    };
+}
diff --git a/tests/ui/ergonomic-clones/closure/multiple-use-variants.stderr b/tests/ui/ergonomic-clones/closure/multiple-use-variants.stderr
new file mode 100644
index 00000000000..7b25ca9bba8
--- /dev/null
+++ b/tests/ui/ergonomic-clones/closure/multiple-use-variants.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `inner`
+  --> $DIR/multiple-use-variants.rs:32:19
+   |
+LL |         takes_val(inner);
+   |                   ----- value moved here
+LL |         takes_val(inner)
+   |                   ^^^^^ value used here after move
+   |
+   = note: move occurs because `inner` has type `Inner<'_, String>`, which does not implement the `Copy` trait
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/ergonomic-clones/closure/rfc2229-migration.fixed b/tests/ui/ergonomic-clones/closure/rfc2229-migration.fixed
new file mode 100644
index 00000000000..fa83b53526a
--- /dev/null
+++ b/tests/ui/ergonomic-clones/closure/rfc2229-migration.fixed
@@ -0,0 +1,26 @@
+//@ run-rustfix
+//@ edition:2018
+//@ check-pass
+#![feature(ergonomic_clones)]
+#![warn(rust_2021_compatibility)]
+#![allow(incomplete_features)]
+
+#[derive(Debug)]
+struct Foo(i32);
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("{:?} dropped", self.0);
+    }
+}
+
+fn main() {
+    let a = (Foo(0), Foo(1));
+    let f = use || {
+        let _ = &a;
+        //~^ HELP: add a dummy
+        //~| WARNING: drop order
+        let x = a.0;
+        println!("{:?}", x);
+    };
+    f();
+}
diff --git a/tests/ui/ergonomic-clones/closure/rfc2229-migration.rs b/tests/ui/ergonomic-clones/closure/rfc2229-migration.rs
new file mode 100644
index 00000000000..4070e5c35a4
--- /dev/null
+++ b/tests/ui/ergonomic-clones/closure/rfc2229-migration.rs
@@ -0,0 +1,25 @@
+//@ run-rustfix
+//@ edition:2018
+//@ check-pass
+#![feature(ergonomic_clones)]
+#![warn(rust_2021_compatibility)]
+#![allow(incomplete_features)]
+
+#[derive(Debug)]
+struct Foo(i32);
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("{:?} dropped", self.0);
+    }
+}
+
+fn main() {
+    let a = (Foo(0), Foo(1));
+    let f = use || {
+        //~^ HELP: add a dummy
+        //~| WARNING: drop order
+        let x = a.0;
+        println!("{:?}", x);
+    };
+    f();
+}
diff --git a/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr b/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr
new file mode 100644
index 00000000000..b980be6cb86
--- /dev/null
+++ b/tests/ui/ergonomic-clones/closure/rfc2229-migration.stderr
@@ -0,0 +1,27 @@
+warning: changes to closure capture in Rust 2021 will affect drop order
+  --> $DIR/rfc2229-migration.rs:18:13
+   |
+LL |     let f = use || {
+   |             ^^^^^^
+...
+LL |         let x = a.0;
+   |                 --- in Rust 2018, this closure captures all of `a`, but in Rust 2021, it will only capture `a.0`
+...
+LL | }
+   | - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure
+   |
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
+note: the lint level is defined here
+  --> $DIR/rfc2229-migration.rs:5:9
+   |
+LL | #![warn(rust_2021_compatibility)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^
+   = note: `#[warn(rust_2021_incompatible_closure_captures)]` implied by `#[warn(rust_2021_compatibility)]`
+help: add a dummy let to cause `a` to be fully captured
+   |
+LL ~     let f = use || {
+LL +         let _ = &a;
+   |
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/ergonomic-clones/closure/spawn-thread.edition2018.stderr b/tests/ui/ergonomic-clones/closure/spawn-thread.edition2018.stderr
new file mode 100644
index 00000000000..ac8e1c5fa85
--- /dev/null
+++ b/tests/ui/ergonomic-clones/closure/spawn-thread.edition2018.stderr
@@ -0,0 +1,28 @@
+error[E0382]: use of moved value: `x`
+  --> $DIR/spawn-thread.rs:15:42
+   |
+LL |       let x = (Arc::new("foo".to_owned()), Arc::new(vec![1, 2, 3]), Arc::new(1));
+   |           - move occurs because `x` has type `(Arc<String>, Arc<Vec<i32>>, Arc<i32>)`, which does not implement the `Copy` trait
+LL |       for _ in 0..10 {
+   |       -------------- inside of this loop
+LL |           let handler = std::thread::spawn(use || {
+   |  __________________________________________-^^^^^
+LL | |
+LL | |             drop((x.0, x.1, x.2));
+   | |                   --- use occurs due to use in closure
+LL | |         });
+   | |_________- value moved here, in previous iteration of loop
+   |
+help: consider moving the expression out of the loop so it is only moved once
+   |
+LL ~     let mut value = std::thread::spawn(use || {
+LL +
+LL +             drop((x.0, x.1, x.2));
+LL +         });
+LL ~     for _ in 0..10 {
+LL ~         let handler = value;
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/ergonomic-clones/closure/spawn-thread.rs b/tests/ui/ergonomic-clones/closure/spawn-thread.rs
new file mode 100644
index 00000000000..289d446c6e6
--- /dev/null
+++ b/tests/ui/ergonomic-clones/closure/spawn-thread.rs
@@ -0,0 +1,50 @@
+//@ revisions: edition2018 edition2024
+//@ [edition2018] edition: 2018
+//@ [edition2024] edition: 2024
+//@ [edition2024] check-pass
+
+#![feature(ergonomic_clones)]
+#![allow(incomplete_features)]
+
+use std::sync::Arc;
+
+fn foo() {
+    // The type is a tuple and doesn't implement UseCloned
+    let x = (Arc::new("foo".to_owned()), Arc::new(vec![1, 2, 3]), Arc::new(1));
+    for _ in 0..10 {
+        let handler = std::thread::spawn(use || {
+            //[edition2018]~^ ERROR use of moved value: `x` [E0382]
+            drop((x.0, x.1, x.2));
+        });
+        handler.join().unwrap();
+    }
+}
+
+fn bar() {
+    let x = Arc::new("foo".to_owned());
+    let y = Arc::new(vec![1, 2, 3]);
+    let z = Arc::new(1);
+
+    for _ in 0..10 {
+        let handler = std::thread::spawn(use || {
+            drop((x, y, z));
+        });
+        handler.join().unwrap();
+    }
+}
+
+fn baz() {
+    use std::sync::Arc;
+    use std::thread;
+
+    let five = Arc::new(5);
+
+    for _ in 0..10 {
+        let handler = thread::spawn(use || {
+            println!("{five:?}");
+        });
+        handler.join().unwrap();
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/ergonomic-clones/dotuse/block.rs b/tests/ui/ergonomic-clones/dotuse/block.rs
new file mode 100644
index 00000000000..2e423c67d02
--- /dev/null
+++ b/tests/ui/ergonomic-clones/dotuse/block.rs
@@ -0,0 +1,11 @@
+//@ check-pass
+
+#![feature(ergonomic_clones)]
+#![allow(incomplete_features)]
+
+fn use_block_test(x: i32) -> i32 {
+    let x = { let x = x + 1; x }.use;
+    x
+}
+
+fn main() {}
diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr
index 7b9fd6bb4c5..c8394575e71 100644
--- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr
+++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.current.stderr
@@ -13,7 +13,7 @@ LL | fn projection_bound<T: for<'a> Trait<'a, Assoc = usize>>() {}
    |                                          ^^^^^^^^^^^^^
 
 error[E0308]: mismatched types
-  --> $DIR/candidate-from-env-universe-err-project.rs:53:30
+  --> $DIR/candidate-from-env-universe-err-project.rs:52:30
    |
 LL |     let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| ();
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
@@ -22,7 +22,7 @@ LL |     let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| ();
               found associated type `<T as Trait<'a>>::Assoc`
 
 error[E0308]: mismatched types
-  --> $DIR/candidate-from-env-universe-err-project.rs:53:30
+  --> $DIR/candidate-from-env-universe-err-project.rs:52:30
    |
 LL |     let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| ();
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr
index 6e0ec5620da..468dc3b082e 100644
--- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr
+++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.next.stderr
@@ -22,38 +22,20 @@ note: required by a bound in `projection_bound`
 LL | fn projection_bound<T: for<'a> Trait<'a, Assoc = usize>>() {}
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `projection_bound`
 
-error[E0271]: type mismatch resolving `<T as Trait<'a>>::Assoc == usize`
-  --> $DIR/candidate-from-env-universe-err-project.rs:38:24
-   |
-LL |     projection_bound::<T>();
-   |                        ^ type mismatch resolving `<T as Trait<'a>>::Assoc == usize`
-   |
-note: types differ
-  --> $DIR/candidate-from-env-universe-err-project.rs:14:18
-   |
-LL |     type Assoc = usize;
-   |                  ^^^^^
-note: required by a bound in `projection_bound`
-  --> $DIR/candidate-from-env-universe-err-project.rs:18:42
-   |
-LL | fn projection_bound<T: for<'a> Trait<'a, Assoc = usize>>() {}
-   |                                          ^^^^^^^^^^^^^ required by this bound in `projection_bound`
-
 error: higher-ranked subtype error
-  --> $DIR/candidate-from-env-universe-err-project.rs:53:30
+  --> $DIR/candidate-from-env-universe-err-project.rs:52:30
    |
 LL |     let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| ();
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: higher-ranked subtype error
-  --> $DIR/candidate-from-env-universe-err-project.rs:53:30
+  --> $DIR/candidate-from-env-universe-err-project.rs:52:30
    |
 LL |     let _higher_ranked_norm: for<'a> fn(<T as Trait<'a>>::Assoc) = |_| ();
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0271, E0277.
-For more information about an error, try `rustc --explain E0271`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs
index a77d87f6fa7..d70e3922382 100644
--- a/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs
+++ b/tests/ui/higher-ranked/leak-check/candidate-from-env-universe-err-project.rs
@@ -36,9 +36,8 @@ fn function2<T: Trait<'static, Assoc = usize>>() {
     // does not use the leak check when trying the where-bound, causing us
     // to prefer it over the impl, resulting in a placeholder error.
     projection_bound::<T>();
-    //[next]~^ ERROR type mismatch resolving `<T as Trait<'a>>::Assoc == usize`
-    //[next]~| ERROR the trait bound `for<'a> T: Trait<'a>` is not satisfied
-    //[current]~^^^ ERROR mismatched types
+    //[next]~^ ERROR the trait bound `for<'a> T: Trait<'a>` is not satisfied
+    //[current]~^^ ERROR mismatched types
 }
 
 fn function3<T: Trait<'static, Assoc = usize>>() {
diff --git a/tests/ui/lint/large_assignments/inline_mir.rs b/tests/ui/lint/large_assignments/inline_mir.rs
new file mode 100644
index 00000000000..fc27b8ff244
--- /dev/null
+++ b/tests/ui/lint/large_assignments/inline_mir.rs
@@ -0,0 +1,24 @@
+#![feature(large_assignments)]
+#![deny(large_assignments)]
+#![move_size_limit = "1000"]
+
+//! Tests that with `-Zinline-mir`, we do NOT get an error that points to the
+//! implementation of `UnsafeCell` since that is not actionable by the user:
+//!
+//! ```text
+//! error: moving 9999 bytes
+//!   --> /rustc/FAKE_PREFIX/library/core/src/cell.rs:2054:9
+//!    |
+//!    = note: value moved from here
+//! ```
+//!
+//! We want the diagnostics to point to the relevant user code.
+
+//@ build-fail
+//@ compile-flags: -Zmir-opt-level=1 -Zinline-mir
+
+pub fn main() {
+    let data = [10u8; 9999];
+    let cell = std::cell::UnsafeCell::new(data); //~ ERROR large_assignments
+    std::hint::black_box(cell);
+}
diff --git a/tests/ui/lint/large_assignments/inline_mir.stderr b/tests/ui/lint/large_assignments/inline_mir.stderr
new file mode 100644
index 00000000000..d9010e24d03
--- /dev/null
+++ b/tests/ui/lint/large_assignments/inline_mir.stderr
@@ -0,0 +1,15 @@
+error: moving 9999 bytes
+  --> $DIR/inline_mir.rs:22:16
+   |
+LL |     let cell = std::cell::UnsafeCell::new(data);
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ value moved from here
+   |
+   = note: The current maximum size is 1000, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
+note: the lint level is defined here
+  --> $DIR/inline_mir.rs:2:9
+   |
+LL | #![deny(large_assignments)]
+   |         ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/mismatched_types/closure-mismatch.stderr b/tests/ui/mismatched_types/closure-mismatch.current.stderr
index 802110c6511..378fe83ea89 100644
--- a/tests/ui/mismatched_types/closure-mismatch.stderr
+++ b/tests/ui/mismatched_types/closure-mismatch.current.stderr
@@ -1,5 +1,5 @@
 error: implementation of `FnOnce` is not general enough
-  --> $DIR/closure-mismatch.rs:8:5
+  --> $DIR/closure-mismatch.rs:12:5
    |
 LL |     baz(|_| ());
    |     ^^^^^^^^^^^ implementation of `FnOnce` is not general enough
@@ -8,7 +8,7 @@ LL |     baz(|_| ());
    = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
 
 error: implementation of `Fn` is not general enough
-  --> $DIR/closure-mismatch.rs:8:5
+  --> $DIR/closure-mismatch.rs:12:5
    |
 LL |     baz(|_| ());
    |     ^^^^^^^^^^^ implementation of `Fn` is not general enough
@@ -17,7 +17,7 @@ LL |     baz(|_| ());
    = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2`
 
 error: implementation of `FnOnce` is not general enough
-  --> $DIR/closure-mismatch.rs:11:5
+  --> $DIR/closure-mismatch.rs:16:5
    |
 LL |     baz(|x| ());
    |     ^^^^^^^^^^^ implementation of `FnOnce` is not general enough
@@ -26,7 +26,7 @@ LL |     baz(|x| ());
    = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2`
 
 error: implementation of `Fn` is not general enough
-  --> $DIR/closure-mismatch.rs:11:5
+  --> $DIR/closure-mismatch.rs:16:5
    |
 LL |     baz(|x| ());
    |     ^^^^^^^^^^^ implementation of `Fn` is not general enough
diff --git a/tests/ui/mismatched_types/closure-mismatch.next.stderr b/tests/ui/mismatched_types/closure-mismatch.next.stderr
new file mode 100644
index 00000000000..6b4620aa8d1
--- /dev/null
+++ b/tests/ui/mismatched_types/closure-mismatch.next.stderr
@@ -0,0 +1,67 @@
+error[E0277]: the trait bound `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}: Foo` is not satisfied
+  --> $DIR/closure-mismatch.rs:12:9
+   |
+LL |     baz(|_| ());
+   |     --- ^^^^^^ unsatisfied trait bound
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}`
+   = note: expected a closure with signature `for<'a> fn(&'a ())`
+              found a closure with signature `fn(&())`
+note: this is a known limitation of the trait solver that will be lifted in the future
+  --> $DIR/closure-mismatch.rs:12:9
+   |
+LL |     baz(|_| ());
+   |     ----^^^----
+   |     |   |
+   |     |   the trait solver is unable to infer the generic types that should be inferred from this argument
+   |     add turbofish arguments to this call to specify the types manually, even if it's redundant
+note: required for `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}` to implement `Foo`
+  --> $DIR/closure-mismatch.rs:7:18
+   |
+LL | impl<T: Fn(&())> Foo for T {}
+   |         -------  ^^^     ^
+   |         |
+   |         unsatisfied trait bound introduced here
+note: required by a bound in `baz`
+  --> $DIR/closure-mismatch.rs:9:11
+   |
+LL | fn baz<T: Foo>(_: T) {}
+   |           ^^^ required by this bound in `baz`
+
+error[E0277]: the trait bound `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}: Foo` is not satisfied
+  --> $DIR/closure-mismatch.rs:16:9
+   |
+LL |     baz(|x| ());
+   |     --- ^^^^^^ unsatisfied trait bound
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}`
+   = note: expected a closure with signature `for<'a> fn(&'a ())`
+              found a closure with signature `fn(&())`
+note: this is a known limitation of the trait solver that will be lifted in the future
+  --> $DIR/closure-mismatch.rs:16:9
+   |
+LL |     baz(|x| ());
+   |     ----^^^----
+   |     |   |
+   |     |   the trait solver is unable to infer the generic types that should be inferred from this argument
+   |     add turbofish arguments to this call to specify the types manually, even if it's redundant
+note: required for `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}` to implement `Foo`
+  --> $DIR/closure-mismatch.rs:7:18
+   |
+LL | impl<T: Fn(&())> Foo for T {}
+   |         -------  ^^^     ^
+   |         |
+   |         unsatisfied trait bound introduced here
+note: required by a bound in `baz`
+  --> $DIR/closure-mismatch.rs:9:11
+   |
+LL | fn baz<T: Foo>(_: T) {}
+   |           ^^^ required by this bound in `baz`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/mismatched_types/closure-mismatch.rs b/tests/ui/mismatched_types/closure-mismatch.rs
index efaed4dc1b9..1a24c760a6a 100644
--- a/tests/ui/mismatched_types/closure-mismatch.rs
+++ b/tests/ui/mismatched_types/closure-mismatch.rs
@@ -1,3 +1,7 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
 trait Foo {}
 
 impl<T: Fn(&())> Foo for T {}
@@ -6,9 +10,11 @@ fn baz<T: Foo>(_: T) {}
 
 fn main() {
     baz(|_| ());
-    //~^ ERROR implementation of `FnOnce` is not general enough
-    //~| ERROR implementation of `Fn` is not general enough
+    //[current]~^ ERROR implementation of `FnOnce` is not general enough
+    //[current]~| ERROR implementation of `Fn` is not general enough
+    //[next]~^^^ ERROR Foo` is not satisfied
     baz(|x| ());
-    //~^ ERROR implementation of `FnOnce` is not general enough
-    //~| ERROR implementation of `Fn` is not general enough
+    //[current]~^ ERROR implementation of `FnOnce` is not general enough
+    //[current]~| ERROR implementation of `Fn` is not general enough
+    //[next]~^^^ ERROR Foo` is not satisfied
 }
diff --git a/tests/ui/panic-runtime/two-panic-runtimes.rs b/tests/ui/panic-runtime/two-panic-runtimes.rs
index 15c08cbe30d..7add07ef600 100644
--- a/tests/ui/panic-runtime/two-panic-runtimes.rs
+++ b/tests/ui/panic-runtime/two-panic-runtimes.rs
@@ -1,7 +1,6 @@
 // ignore-tidy-linelength
 //@ build-fail
-//@ compile-flags: --error-format=human
-//@ error-pattern: cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2
+//@ dont-require-annotations:ERROR
 //@ dont-check-compiler-stderr
 //@ aux-build:panic-runtime-unwind.rs
 //@ aux-build:panic-runtime-unwind2.rs
@@ -16,7 +15,8 @@ extern crate panic_runtime_lang_items;
 
 fn main() {}
 
-// FIXME: The second and third errors are target-dependent.
-//FIXME~? ERROR cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2
+//~? ERROR cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2
+// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
+// instead of `dont-require-annotations`.
 //FIXME~? ERROR the linked panic runtime `panic_runtime_unwind2` is not compiled with this crate's panic strategy `abort`
 //FIXME~? ERROR the crate `panic_runtime_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`
diff --git a/tests/ui/panic-runtime/want-abort-got-unwind.rs b/tests/ui/panic-runtime/want-abort-got-unwind.rs
index ed61c2613df..1ae2e623f10 100644
--- a/tests/ui/panic-runtime/want-abort-got-unwind.rs
+++ b/tests/ui/panic-runtime/want-abort-got-unwind.rs
@@ -1,7 +1,6 @@
 // ignore-tidy-linelength
 //@ build-fail
-//@ compile-flags: --error-format=human
-//@ error-pattern: the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
+//@ dont-require-annotations:ERROR
 //@ dont-check-compiler-stderr
 //@ aux-build:panic-runtime-unwind.rs
 //@ compile-flags:-C panic=abort
@@ -10,7 +9,8 @@ extern crate panic_runtime_unwind;
 
 fn main() {}
 
-// FIXME: The first and third errors are target-dependent.
+//~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
+// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
+// instead of `dont-require-annotations`.
 //FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind
-//FIXME~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
 //FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`
diff --git a/tests/ui/panic-runtime/want-abort-got-unwind2.rs b/tests/ui/panic-runtime/want-abort-got-unwind2.rs
index 504fd779e09..dc4d3ea86d8 100644
--- a/tests/ui/panic-runtime/want-abort-got-unwind2.rs
+++ b/tests/ui/panic-runtime/want-abort-got-unwind2.rs
@@ -1,7 +1,6 @@
 // ignore-tidy-linelength
 //@ build-fail
-//@ compile-flags: --error-format=human
-//@ error-pattern: the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
+//@ dont-require-annotations:ERROR
 //@ dont-check-compiler-stderr
 //@ aux-build:panic-runtime-unwind.rs
 //@ aux-build:wants-panic-runtime-unwind.rs
@@ -11,7 +10,8 @@ extern crate wants_panic_runtime_unwind;
 
 fn main() {}
 
-// FIXME: The first and third errors are target-dependent.
+//~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
+// FIXME: These errors are target-dependent, could be served by some "optional error" annotation
+// instead of `dont-require-annotations`.
 //FIXME~? ERROR cannot link together two panic runtimes: panic_unwind and panic_runtime_unwind
-//FIXME~? ERROR the linked panic runtime `panic_runtime_unwind` is not compiled with this crate's panic strategy `abort`
 //FIXME~? ERROR the crate `panic_unwind` requires panic strategy `unwind` which is incompatible with this crate's strategy of `abort`