about summary refs log tree commit diff
path: root/tests/ui/pattern/move-ref-patterns
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-11-21 04:20:18 +0000
committerMichael Goulet <michael@errs.io>2023-11-21 18:35:47 +0000
commit128feaa2b40d063a834030d3ff9410c9327c5286 (patch)
tree5068d61a731ce5dca2611a26baa7f1d4c3b90fdf /tests/ui/pattern/move-ref-patterns
parent93298ee0dd938c0fece0ee5dbafe851e54dd6386 (diff)
downloadrust-128feaa2b40d063a834030d3ff9410c9327c5286.tar.gz
rust-128feaa2b40d063a834030d3ff9410c9327c5286.zip
Restore closure-kind error messages
Diffstat (limited to 'tests/ui/pattern/move-ref-patterns')
-rw-r--r--tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr53
1 files changed, 31 insertions, 22 deletions
diff --git a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr
index 9a8c8123fba..eba65a61803 100644
--- a/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr
+++ b/tests/ui/pattern/move-ref-patterns/move-ref-patterns-closure-captures.stderr
@@ -1,48 +1,57 @@
-error[E0277]: expected a `FnMut()` closure, found `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}`
-  --> $DIR/move-ref-patterns-closure-captures.rs:17:19
-   |
+error[E0525]: expected a closure that implements the `FnMut` trait, but this closure only implements `FnOnce`
+  --> $DIR/move-ref-patterns-closure-captures.rs:9:14
+   |
+LL |     let c1 = || {
+   |              ^^ this closure implements `FnOnce`, not `FnMut`
+...
+LL |         drop::<U>(_x1);
+   |                   --- closure is `FnOnce` because it moves the variable `_x1` out of its environment
+...
 LL |     accept_fn_mut(&c1);
-   |     ------------- ^^^ expected an `FnMut()` closure, found `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}`
+   |     ------------- --- the requirement to implement `FnMut` derives from here
    |     |
    |     required by a bound introduced by this call
    |
-   = help: the trait `FnMut<()>` is not implemented for closure `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}`
-   = note: wrap the `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}` in a closure with no arguments: `|| { /* code */ }`
-   = note: `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}` implements `FnOnce`, but it must implement `FnMut`, which is more general
 note: required by a bound in `accept_fn_mut`
   --> $DIR/move-ref-patterns-closure-captures.rs:4:31
    |
 LL |     fn accept_fn_mut(_: &impl FnMut()) {}
    |                               ^^^^^^^ required by this bound in `accept_fn_mut`
 
-error[E0277]: expected a `Fn()` closure, found `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}`
-  --> $DIR/move-ref-patterns-closure-captures.rs:18:15
-   |
+error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
+  --> $DIR/move-ref-patterns-closure-captures.rs:9:14
+   |
+LL |     let c1 = || {
+   |              ^^ this closure implements `FnOnce`, not `Fn`
+...
+LL |         drop::<U>(_x1);
+   |                   --- closure is `FnOnce` because it moves the variable `_x1` out of its environment
+...
 LL |     accept_fn(&c1);
-   |     --------- ^^^ expected an `Fn()` closure, found `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}`
+   |     --------- --- the requirement to implement `Fn` derives from here
    |     |
    |     required by a bound introduced by this call
    |
-   = help: the trait `Fn<()>` is not implemented for closure `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}`
-   = note: wrap the `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}` in a closure with no arguments: `|| { /* code */ }`
-   = note: `{closure@$DIR/move-ref-patterns-closure-captures.rs:9:14: 9:16}` implements `FnOnce`, but it must implement `Fn`, which is more general
 note: required by a bound in `accept_fn`
   --> $DIR/move-ref-patterns-closure-captures.rs:5:27
    |
 LL |     fn accept_fn(_: &impl Fn()) {}
    |                           ^^^^ required by this bound in `accept_fn`
 
-error[E0277]: expected a `Fn()` closure, found `{closure@$DIR/move-ref-patterns-closure-captures.rs:20:14: 20:16}`
-  --> $DIR/move-ref-patterns-closure-captures.rs:26:15
-   |
+error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
+  --> $DIR/move-ref-patterns-closure-captures.rs:20:14
+   |
+LL |     let c2 = || {
+   |              ^^ this closure implements `FnMut`, not `Fn`
+...
+LL |         drop::<&mut U>(_x2);
+   |                        --- closure is `FnMut` because it mutates the variable `_x2` here
+...
 LL |     accept_fn(&c2);
-   |     --------- ^^^ expected an `Fn()` closure, found `{closure@$DIR/move-ref-patterns-closure-captures.rs:20:14: 20:16}`
+   |     --------- --- the requirement to implement `Fn` derives from here
    |     |
    |     required by a bound introduced by this call
    |
-   = help: the trait `Fn<()>` is not implemented for closure `{closure@$DIR/move-ref-patterns-closure-captures.rs:20:14: 20:16}`
-   = note: wrap the `{closure@$DIR/move-ref-patterns-closure-captures.rs:20:14: 20:16}` in a closure with no arguments: `|| { /* code */ }`
-   = note: `{closure@$DIR/move-ref-patterns-closure-captures.rs:20:14: 20:16}` implements `FnMut`, but it must implement `Fn`, which is more general
 note: required by a bound in `accept_fn`
   --> $DIR/move-ref-patterns-closure-captures.rs:5:27
    |
@@ -51,4 +60,4 @@ LL |     fn accept_fn(_: &impl Fn()) {}
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0525`.