diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:29 +0000 |
commit | 631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch) | |
tree | a1b87c8f8cad01cf18f7c5f57a08f102771ed303 /tests/ui/pattern | |
parent | Adding debian version 1.69.0+dfsg1-1. (diff) | |
download | rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/pattern')
44 files changed, 606 insertions, 574 deletions
diff --git a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr index 29cd6c45c..25838fbf0 100644 --- a/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr +++ b/tests/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr @@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14 | LL | Some(ref _y @ _z) => {} - | ------^^^-- - | | | - | | value is moved into `_z` here + | ^^^^^^ -- value is moved into `_z` here + | | | value is borrowed by `_y` here error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:19:14 | LL | Some(_z @ ref _y) => {} - | --^^^------ - | | | - | | value borrowed here after move + | ^^ ------ value borrowed here after move + | | | value moved into `_z` here | move occurs because `_z` has type `X` which does not implement the `Copy` trait | @@ -26,18 +24,16 @@ error: cannot move out of value because it is borrowed --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14 | LL | Some(ref mut _y @ _z) => {} - | ----------^^^-- - | | | - | | value is moved into `_z` here + | ^^^^^^^^^^ -- value is moved into `_z` here + | | | value is mutably borrowed by `_y` here error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:33:14 | LL | Some(_z @ ref mut _y) => {} - | --^^^---------- - | | | - | | value borrowed here after move + | ^^ ---------- value borrowed here after move + | | | value moved into `_z` here | move occurs because `_z` has type `X` which does not implement the `Copy` trait | diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr index 2c123b01e..9305facc4 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr @@ -2,72 +2,64 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-at-and-box.rs:31:9 | LL | let ref a @ box b = Box::new(NC); - | -----^^^^^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:34:9 | LL | let ref a @ box ref mut b = Box::new(nc()); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:36:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:38:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:42:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | -----^^^^^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:48:9 | LL | let ref mut a @ box ref b = Box::new(NC); - | ---------^^^^^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:62:9 | LL | ref mut a @ box ref b => { - | ---------^^^^^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:54:11 | LL | fn f5(ref mut a @ box ref b: Box<NC>) { - | ---------^^^^^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error[E0382]: borrow of moved value diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr index d6474f1b4..c440f4619 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr @@ -2,9 +2,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:6:9 | LL | let a @ ref b = U; - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr index 389e86e64..13989ebad 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr @@ -2,9 +2,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:22:9 | LL | let a @ ref b = U; - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | @@ -17,9 +16,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | -^^^^^^^^^^^^---------^^^^^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -33,9 +31,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:14 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -48,9 +45,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:33 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -63,9 +59,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:29:9 | LL | let a @ [ref mut b, ref c] = [U, U]; - | -^^^^---------^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait @@ -79,9 +74,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:9 | LL | let a @ ref b = u(); - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | @@ -94,9 +88,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | -^^^^^^^^^^^^---------^^^^^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -110,9 +103,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:14 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -125,9 +117,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:33 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -140,9 +131,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:38:9 | LL | let a @ [ref mut b, ref c] = [u(), u()]; - | -^^^^---------^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait @@ -156,9 +146,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:42:9 | LL | a @ Some(ref b) => {} - | -^^^^^^^^-----^ - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait | @@ -171,9 +160,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:9 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait @@ -187,9 +175,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:19 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -202,9 +189,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:38 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -217,9 +203,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:9 | LL | mut a @ Some([ref b, ref mut c]) => {} - | -----^^^^^^^^^-----^^---------^^ - | | | | - | | | value borrowed here after move + | ^^^^^ ----- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait @@ -233,9 +218,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:9 | LL | a @ Some(ref b) => {} - | -^^^^^^^^-----^ - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait | @@ -248,9 +232,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:9 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait @@ -264,9 +247,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:19 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----^^^--------- - | | | - | | value borrowed here after move + | ^^^^^ --------- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -279,9 +261,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:38 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -294,9 +275,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:9 | LL | mut a @ Some([ref b, ref mut c]) => {} - | -----^^^^^^^^^-----^^---------^^ - | | | | - | | | value borrowed here after move + | ^^^^^ ----- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait @@ -310,9 +290,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:11:11 | LL | fn f1(a @ ref b: U) {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `U` which does not implement the `Copy` trait | @@ -325,9 +304,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | -----^^^^^^^^-----^^^^^^^^^^-----^ - | | | | - | | | value borrowed here after move + | ^^^^^ ----- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -341,9 +319,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:20 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `U` which does not implement the `Copy` trait | @@ -356,9 +333,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:31 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | -----^^^----- - | | | - | | value borrowed here after move + | ^^^^^ ----- value borrowed here after move + | | | value moved into `d` here | move occurs because `d` has type `U` which does not implement the `Copy` trait | @@ -371,9 +347,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:19:11 | LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {} - | -^^^^---------^^-----^ - | | | | - | | | value borrowed here after move + | ^ --------- ----- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr index 4f7fbc9e0..00593b2a9 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr @@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:24:9 | LL | let ref a @ b = U; - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:9 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); - | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -21,27 +19,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:26:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9 | LL | let ref mut a @ [b, mut c] = [U, U]; - | ---------^^^^-^^-----^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -49,18 +44,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9 | LL | let ref a @ b = u(); - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:9 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -68,27 +61,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:36:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:42:9 | LL | let ref mut a @ [b, mut c] = [u(), u()]; - | ---------^^^^-^^-----^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -96,18 +86,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:47:9 | LL | ref a @ Some(b) => {} - | -----^^^^^^^^-^ - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:9 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -115,27 +103,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:52:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:59:9 | LL | ref mut a @ Some([b, mut c]) => {} - | ---------^^^^^^^^^-^^-----^^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -143,18 +128,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:64:9 | LL | ref a @ Some(b) => {} - | -----^^^^^^^^-^ - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:9 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -162,27 +145,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:69:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:78:9 | LL | ref mut a @ Some([b, mut c]) => {} - | ---------^^^^^^^^^-^^-----^^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here @@ -190,18 +170,16 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:11:11 | LL | fn f1(ref a @ b: U) {} - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:11 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ - | | | | - | | | value is moved into `e` here + | ^^^^^ ----- - value is moved into `e` here + | | | | | value is moved into `c` here | value is borrowed by `a` here @@ -209,27 +187,24 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:20 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | -----^^^----- - | | | - | | value is moved into `c` here + | ^^^^^ ----- value is moved into `c` here + | | | value is borrowed by `b` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:35 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | -----^^^- - | | | - | | value is moved into `e` here + | ^^^^^ - value is moved into `e` here + | | | value is borrowed by `d` here error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11 | LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {} - | ---------^^^^-^^-----^ - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ - ----- value is moved into `c` here + | | | | | value is moved into `b` here | value is mutably borrowed by `a` here diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index f51b50418..d6409d1b6 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -2,18 +2,16 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:9 | LL | ref mut z @ &mut Some(ref a) => { - | ---------^^^^^^^^^^^^^-----^ - | | | - | | value is borrowed by `a` here + | ^^^^^^^^^ ----- value is borrowed by `a` here + | | | value is mutably borrowed by `z` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:9 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub - | ---------^^^^-----------------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^^^^^ ----- --------- value is mutably borrowed by `c` here + | | | | | value is borrowed by `b` here | value is mutably borrowed by `a` here @@ -21,36 +19,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:22 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub - | -----^^^--------- - | | | - | | value is mutably borrowed by `c` here + | ^^^^^ --------- value is mutably borrowed by `c` here + | | | value is borrowed by `b` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9 | LL | let ref a @ ref mut b = U; - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9 | LL | let ref mut a @ ref b = U; - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -58,9 +52,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); - | ---------^^^^-----^^-----^ - | | | | - | | | value is borrowed by `c` here + | ^^^^^^^^^ ----- ----- value is borrowed by `c` here + | | | | | value is borrowed by `b` here | value is mutably borrowed by `a` here @@ -68,153 +61,136 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9 | LL | let ref mut a @ ref b = u(); - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9 | LL | let ref a @ ref mut b = u(); - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:57:9 | LL | let ref mut a @ ref b = U; - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:61:9 | LL | let ref a @ ref mut b = U; - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { - | ---------^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { - | ---------^^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | -----^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | -----^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} - | -----^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} - | -----^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} - | ---------^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} - | ---------^^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} - | -----^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} - | -----^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} - | ---------^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} - | ---------^^^^^^^-----^ - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -222,9 +198,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -232,9 +207,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | -----^^^^---------^^---------^ - | | | | - | | | value is mutably borrowed by `c` here + | ^^^^^ --------- --------- value is mutably borrowed by `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -242,9 +216,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:134:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); - | ---------^^^^-----^^-----^ - | | | | - | | | value is borrowed by `c` here + | ^^^^^^^^^ ----- ----- value is borrowed by `c` here + | | | | | value is borrowed by `b` here | value is mutably borrowed by `a` here @@ -252,36 +225,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:22:11 | LL | fn f1(ref a @ ref mut b: U) {} - | -----^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^ --------- value is mutably borrowed by `b` here + | | | value is borrowed by `a` here error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11 | LL | fn f2(ref mut a @ ref b: U) {} - | ---------^^^----- - | | | - | | value is borrowed by `b` here + | ^^^^^^^^^ ----- value is borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11 | LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} - | -----^^^^^^^^^^^----------------^^^^^^^^ - | | | - | | value is mutably borrowed by `mid` here + | ^^^^^ ----------- value is mutably borrowed by `mid` here + | | | value is borrowed by `a` here error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:22 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} - | -----^^^------------- - | | | | - | | | value is moved into `c` here + | ^^^^^ --------- - value is moved into `c` here + | | | | | value is mutably borrowed by `b` here | value is borrowed by `a` here @@ -289,9 +258,8 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} - | ---------^^^- - | | | - | | value is moved into `c` here + | ^^^^^^^^^ - value is moved into `c` here + | | | value is mutably borrowed by `b` here error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index a0cb04a06..24189d061 100644 --- a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -2,98 +2,80 @@ error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:26:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:33:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:36:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:39:9 | LL | let ref mut a @ ref mut b = U; - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:44:9 | -LL | let ref mut a @ ( - | ^-------- - | | - | _________value is mutably borrowed by `a` here - | | -LL | | -LL | | ref mut b, - | | --------- value is mutably borrowed by `b` here -LL | | [ -LL | | ref mut c, - | | --------- value is mutably borrowed by `c` here -LL | | ref mut d, - | | --------- value is mutably borrowed by `d` here -LL | | ref e, - | | ----- value is borrowed by `e` here -LL | | ] -LL | | ) = (U, [U, U, U]); - | |_____^ +LL | let ref mut a @ ( + | ^^^^^^^^^ value is mutably borrowed by `a` here +LL | +LL | ref mut b, + | --------- value is mutably borrowed by `b` here +LL | [ +LL | ref mut c, + | --------- value is mutably borrowed by `c` here +LL | ref mut d, + | --------- value is mutably borrowed by `d` here +LL | ref e, + | ----- value is borrowed by `e` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:54:9 | -LL | let ref mut a @ ( - | ^-------- - | | - | _________value is mutably borrowed by `a` here - | | -LL | | -LL | | ref mut b, - | | --------- value is mutably borrowed by `b` here -LL | | [ -LL | | ref mut c, - | | --------- value is mutably borrowed by `c` here -LL | | ref mut d, - | | --------- value is mutably borrowed by `d` here -LL | | ref e, - | | ----- value is borrowed by `e` here -LL | | ] -LL | | ) = (u(), [u(), u(), u()]); - | |_________^ +LL | let ref mut a @ ( + | ^^^^^^^^^ value is mutably borrowed by `a` here +LL | +LL | ref mut b, + | --------- value is mutably borrowed by `b` here +LL | [ +LL | ref mut c, + | --------- value is mutably borrowed by `c` here +LL | ref mut d, + | --------- value is mutably borrowed by `d` here +LL | ref e, + | ----- value is borrowed by `e` here error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:64:9 | LL | let a @ (ref mut b, ref mut c) = (U, U); - | -^^^^---------^^---------^ - | | | | - | | | value borrowed here after move + | ^ --------- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait @@ -107,9 +89,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:67:9 | LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- - | -^^^^-^^^-^^-^^ - | | | | | - | | | | value borrowed here after move + | ^ - - - value borrowed here after move + | | | | | | | value borrowed here after move | | value borrowed here after move | value moved into `a` here @@ -124,9 +105,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:70:9 | LL | let a @ &mut ref mut b = &mut U; - | -^^^^^^^^--------- - | | | - | | value borrowed here after move + | ^ --------- value borrowed here after move + | | | value moved into `a` here | move occurs because `a` has type `&mut U` which does not implement the `Copy` trait | @@ -139,9 +119,8 @@ error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:72:9 | LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); - | -^^^^^^^^^---------^^---------^ - | | | | - | | | value borrowed here after move + | ^ --------- --------- value borrowed here after move + | | | | | value borrowed here after move | value moved into `a` here | move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait @@ -155,117 +134,99 @@ error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:76:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:76:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------^^^^^^^---------^ - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:8:11 | LL | fn f1(ref mut a @ ref mut b: U) {} - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:10:11 | LL | fn f2(ref mut a @ ref mut b: U) {} - | ---------^^^--------- - | | | - | | value is mutably borrowed by `b` here + | ^^^^^^^^^ --------- value is mutably borrowed by `b` here + | | | value is mutably borrowed by `a` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:13:9 | -LL | ref mut a @ [ - | ^-------- - | | - | _________value is mutably borrowed by `a` here - | | -LL | | -LL | | [ref b @ .., _], - | | ---------- value is borrowed by `b` here -LL | | [_, ref mut mid @ ..], - | | ---------------- value is mutably borrowed by `mid` here -LL | | .., -LL | | [..], -LL | | ] : [[U; 4]; 5] - | |_________^ +LL | ref mut a @ [ + | ^^^^^^^^^ value is mutably borrowed by `a` here +LL | +LL | [ref b @ .., _], + | ----- value is borrowed by `b` here +LL | [_, ref mut mid @ ..], + | ----------- value is mutably borrowed by `mid` here error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:21:22 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} - | ---------^^^------------- - | | | | - | | | value is moved into `c` here + | ^^^^^^^^^ --------- - value is moved into `c` here + | | | | | value is mutably borrowed by `b` here | value is mutably borrowed by `a` here @@ -273,9 +234,8 @@ error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-twice.rs:21:34 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} - | ---------^^^- - | | | - | | value is moved into `c` here + | ^^^^^^^^^ - value is moved into `c` here + | | | value is mutably borrowed by `b` here error[E0499]: cannot borrow value as mutable more than once at a time diff --git a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr index 73ebbf481..36515c1a2 100644 --- a/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr +++ b/tests/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr @@ -2,36 +2,32 @@ error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:26:9 | LL | let ref a @ b = NotCopy; - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:29:9 | LL | let ref mut a @ b = NotCopy; - | ---------^^^- - | | | - | | value is moved into `b` here + | ^^^^^^^^^ - value is moved into `b` here + | | | value is mutably borrowed by `a` here error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:34:12 | LL | Ok(ref a @ b) | Err(b @ ref a) => { - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error: borrow of moved value --> $DIR/default-binding-modes-both-sides-independent.rs:34:29 | LL | Ok(ref a @ b) | Err(b @ ref a) => { - | -^^^----- - | | | - | | value borrowed here after move + | ^ ----- value borrowed here after move + | | | value moved into `b` here | move occurs because `b` has type `NotCopy` which does not implement the `Copy` trait | @@ -44,9 +40,8 @@ error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:42:9 | LL | ref a @ b => { - | -----^^^- - | | | - | | value is moved into `b` here + | ^^^^^ - value is moved into `b` here + | | | value is borrowed by `a` here error[E0382]: borrow of moved value diff --git a/tests/ui/pattern/issue-106552.stderr b/tests/ui/pattern/issue-106552.stderr index ed5d40c09..96f3d6845 100644 --- a/tests/ui/pattern/issue-106552.stderr +++ b/tests/ui/pattern/issue-106552.stderr @@ -9,8 +9,8 @@ LL | let 5 = 6; = note: the matched value is of type `i32` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let 5 = 6 { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let 5 = 6 { todo!() }; + | ++ +++++++++++ help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits | LL | let _5 = 6; @@ -20,7 +20,7 @@ error[E0005]: refutable pattern in local binding --> $DIR/issue-106552.rs:5:9 | LL | let x @ 5 = 6; - | ^^^^^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered + | ^ patterns `i32::MIN..=4_i32` and `6_i32..=i32::MAX` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html diff --git a/tests/ui/pattern/issue-106862.fixed b/tests/ui/pattern/issue-106862.fixed new file mode 100644 index 000000000..9b27a61ff --- /dev/null +++ b/tests/ui/pattern/issue-106862.fixed @@ -0,0 +1,44 @@ +// run-rustfix + +#![allow(unused)] + +use Foo::{FooB, FooA}; + +enum Foo { + FooA { opt_x: Option<i32>, y: i32 }, + FooB { x: i32, y: i32 } +} + +fn main() { + let f = FooB { x: 3, y: 4 }; + + match f { + FooB { x: a, y: b } => println!("{} {}", a, b), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB { x, y } => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooA { opt_x: Some(x), y } => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooA` + _ => (), + } + + match f { + FooB { x: a, y: _ } => println!("{}", a), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB { x, y } => (), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } +} diff --git a/tests/ui/pattern/issue-106862.rs b/tests/ui/pattern/issue-106862.rs new file mode 100644 index 000000000..590430a78 --- /dev/null +++ b/tests/ui/pattern/issue-106862.rs @@ -0,0 +1,44 @@ +// run-rustfix + +#![allow(unused)] + +use Foo::{FooB, FooA}; + +enum Foo { + FooA { opt_x: Option<i32>, y: i32 }, + FooB { x: i32, y: i32 } +} + +fn main() { + let f = FooB { x: 3, y: 4 }; + + match f { + FooB(a, b) => println!("{} {}", a, b), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB(x, y) => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooA(Some(x), y) => println!("{} {}", x, y), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooA` + _ => (), + } + + match f { + FooB(a, _, _) => println!("{}", a), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } + + match f { + FooB() => (), + //~^ ERROR expected tuple struct or tuple variant, found variant `FooB` + _ => (), + } +} diff --git a/tests/ui/pattern/issue-106862.stderr b/tests/ui/pattern/issue-106862.stderr new file mode 100644 index 000000000..27f8ac972 --- /dev/null +++ b/tests/ui/pattern/issue-106862.stderr @@ -0,0 +1,48 @@ +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:16:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB(a, b) => println!("{} {}", a, b), + | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: b }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:22:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB(x, y) => println!("{} {}", x, y), + | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooA` + --> $DIR/issue-106862.rs:28:9 + | +LL | FooA { opt_x: Option<i32>, y: i32 }, + | ----------------------------------- `FooA` defined here +... +LL | FooA(Some(x), y) => println!("{} {}", x, y), + | ^^^^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooA { opt_x: Some(x), y }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:34:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB(a, _, _) => println!("{}", a), + | ^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: _ }` + +error[E0532]: expected tuple struct or tuple variant, found variant `FooB` + --> $DIR/issue-106862.rs:40:9 + | +LL | FooB { x: i32, y: i32 } + | ----------------------- `FooB` defined here +... +LL | FooB() => (), + | ^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr b/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr index 54ecc2498..62c90b638 100644 --- a/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr +++ b/tests/ui/pattern/issue-68393-let-pat-assoc-constant.stderr @@ -1,15 +1,15 @@ error[E0158]: associated consts cannot be referenced in patterns - --> $DIR/issue-68393-let-pat-assoc-constant.rs:20:40 - | -LL | pub fn test<A: Foo, B: Foo>(arg: EFoo, A::X: EFoo) { - | ^^^^ - -error[E0158]: associated consts cannot be referenced in patterns --> $DIR/issue-68393-let-pat-assoc-constant.rs:22:9 | LL | let A::X = arg; | ^^^^ +error[E0158]: associated consts cannot be referenced in patterns + --> $DIR/issue-68393-let-pat-assoc-constant.rs:20:40 + | +LL | pub fn test<A: Foo, B: Foo>(arg: EFoo, A::X: EFoo) { + | ^^^^ + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0158`. diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index d92957461..0d7f2e4af 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -113,8 +113,8 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use the tuple variant pattern syntax instead | -LL | E1::Z1(/* fields */) => {} - | ~~~~~~~~~~~~~~~~~~~~ +LL | E1::Z1() => {} + | ~~~~~~~~ help: a unit variant with a similar name exists | LL | E1::Z0 => {} diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed index b28dce881..b469fade3 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.fixed @@ -4,7 +4,7 @@ fn main() { match Some(1) { //~ ERROR non-exhaustive patterns: `None` not covered Some(1) => {} // hello - Some(_) => {} + Some(_) => {}, None => todo!() } } diff --git a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr index 2a016048f..5f2c89246 100644 --- a/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr +++ b/tests/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr @@ -12,7 +12,7 @@ note: `Option<i32>` defined here = note: the matched value is of type `Option<i32>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Some(_) => {} +LL ~ Some(_) => {}, LL + None => todo!() | diff --git a/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr b/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr index 358421cd6..dbd46da44 100644 --- a/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr +++ b/tests/ui/pattern/usefulness/const-partial_eq-fallback-ice.stderr @@ -3,6 +3,9 @@ error: to use a constant of type `MyType` in a pattern, `MyType` must be annotat | LL | if let CONSTANT = &&MyType { | ^^^^^^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/consts-opaque.stderr b/tests/ui/pattern/usefulness/consts-opaque.stderr index 35396751a..3f0b4a9f2 100644 --- a/tests/ui/pattern/usefulness/consts-opaque.stderr +++ b/tests/ui/pattern/usefulness/consts-opaque.stderr @@ -3,36 +3,18 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit | LL | FOO => {} | ^^^ - -error: unreachable pattern - --> $DIR/consts-opaque.rs:32:9 - | -LL | FOO => {} - | --- matches any value -LL | -LL | _ => {} // should not be emitting unreachable warning - | ^ unreachable pattern - | -note: the lint level is defined here - --> $DIR/consts-opaque.rs:6:9 | -LL | #![deny(unreachable_patterns)] - | ^^^^^^^^^^^^^^^^^^^^ + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/consts-opaque.rs:37:9 | LL | FOO_REF => {} | ^^^^^^^ - -error: unreachable pattern - --> $DIR/consts-opaque.rs:39:9 | -LL | FOO_REF => {} - | ------- matches any value -LL | -LL | Foo(_) => {} // should not be emitting unreachable warning - | ^^^^^^ unreachable pattern + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details warning: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]` --> $DIR/consts-opaque.rs:45:9 @@ -42,6 +24,8 @@ LL | FOO_REF_REF => {} | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411> + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details = note: `#[warn(indirect_structural_match)]` on by default error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` @@ -49,6 +33,87 @@ error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated wit | LL | BAR => {} // should not be emitting unreachable warning | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:61:9 + | +LL | BAR => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:70:9 + | +LL | BAR => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:72:9 + | +LL | BAR => {} // should not be emitting unreachable warning + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:80:9 + | +LL | BAZ => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:90:9 + | +LL | BAZ => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` + --> $DIR/consts-opaque.rs:97:9 + | +LL | BAZ => {} + | ^^^ + | + = note: the traits must be derived, manual `impl`s are not sufficient + = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details + +error: unreachable pattern + --> $DIR/consts-opaque.rs:32:9 + | +LL | FOO => {} + | --- matches any value +LL | +LL | _ => {} // should not be emitting unreachable warning + | ^ unreachable pattern + | +note: the lint level is defined here + --> $DIR/consts-opaque.rs:6:9 + | +LL | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/consts-opaque.rs:39:9 + | +LL | FOO_REF => {} + | ------- matches any value +LL | +LL | Foo(_) => {} // should not be emitting unreachable warning + | ^^^^^^ unreachable pattern error: unreachable pattern --> $DIR/consts-opaque.rs:53:9 @@ -67,12 +132,6 @@ LL | Bar => {} LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:61:9 - | -LL | BAR => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:63:9 | @@ -91,18 +150,6 @@ LL | BAR => {} LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:70:9 - | -LL | BAR => {} - | ^^^ - -error: to use a constant of type `Bar` in a pattern, `Bar` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:72:9 - | -LL | BAR => {} // should not be emitting unreachable warning - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:72:9 | @@ -121,12 +168,6 @@ LL | BAR => {} LL | _ => {} // should not be emitting unreachable warning | ^ unreachable pattern -error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:80:9 - | -LL | BAZ => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:82:9 | @@ -145,12 +186,6 @@ LL | BAZ => {} LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:90:9 - | -LL | BAZ => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:92:9 | @@ -160,12 +195,6 @@ LL | LL | _ => {} | ^ unreachable pattern -error: to use a constant of type `Baz` in a pattern, `Baz` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/consts-opaque.rs:97:9 - | -LL | BAZ => {} - | ^^^ - error: unreachable pattern --> $DIR/consts-opaque.rs:99:9 | diff --git a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr index 17e1a2304..ff29de03d 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr @@ -12,7 +12,7 @@ LL | pub enum HiddenEnum { = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ HiddenEnum::B => {} +LL ~ HiddenEnum::B => {}, LL + _ => todo!() | @@ -33,7 +33,7 @@ LL | B, = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ HiddenEnum::C => {} +LL ~ HiddenEnum::C => {}, LL + HiddenEnum::B => todo!() | @@ -54,7 +54,7 @@ LL | B, = note: the matched value is of type `HiddenEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ HiddenEnum::A => {} +LL ~ HiddenEnum::A => {}, LL + HiddenEnum::B | _ => todo!() | @@ -72,7 +72,7 @@ note: `Option<HiddenEnum>` defined here = note: the matched value is of type `Option<HiddenEnum>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ Some(HiddenEnum::A) => {} +LL ~ Some(HiddenEnum::A) => {}, LL + Some(HiddenEnum::B) | Some(_) => todo!() | @@ -93,7 +93,7 @@ LL | C, = note: the matched value is of type `InCrate` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ InCrate::B => {} +LL ~ InCrate::B => {}, LL + InCrate::C => todo!() | diff --git a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr index 5e12bc1d2..5a145efce 100644 --- a/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match.exhaustive_patterns.stderr @@ -162,7 +162,7 @@ LL | match_guarded_arm!(0u8); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | @@ -180,7 +180,7 @@ LL | struct NonEmptyStruct1; = note: the matched value is of type `NonEmptyStruct1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct1 => todo!() | @@ -198,7 +198,7 @@ LL | struct NonEmptyStruct2(bool); = note: the matched value is of type `NonEmptyStruct2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct2(_) => todo!() | @@ -216,7 +216,7 @@ LL | union NonEmptyUnion1 { = note: the matched value is of type `NonEmptyUnion1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion1 { .. } => todo!() | @@ -234,7 +234,7 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion2 { .. } => todo!() | @@ -254,7 +254,7 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum1::Foo(_) => todo!() | @@ -276,7 +276,7 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | @@ -294,7 +294,7 @@ LL | enum NonEmptyEnum5 { = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/empty-match.normal.stderr b/tests/ui/pattern/usefulness/empty-match.normal.stderr index 5e12bc1d2..5a145efce 100644 --- a/tests/ui/pattern/usefulness/empty-match.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match.normal.stderr @@ -162,7 +162,7 @@ LL | match_guarded_arm!(0u8); = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | @@ -180,7 +180,7 @@ LL | struct NonEmptyStruct1; = note: the matched value is of type `NonEmptyStruct1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct1 => todo!() | @@ -198,7 +198,7 @@ LL | struct NonEmptyStruct2(bool); = note: the matched value is of type `NonEmptyStruct2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyStruct2(_) => todo!() | @@ -216,7 +216,7 @@ LL | union NonEmptyUnion1 { = note: the matched value is of type `NonEmptyUnion1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion1 { .. } => todo!() | @@ -234,7 +234,7 @@ LL | union NonEmptyUnion2 { = note: the matched value is of type `NonEmptyUnion2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyUnion2 { .. } => todo!() | @@ -254,7 +254,7 @@ LL | Foo(bool), = note: the matched value is of type `NonEmptyEnum1` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum1::Foo(_) => todo!() | @@ -276,7 +276,7 @@ LL | Bar, = note: the matched value is of type `NonEmptyEnum2` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + NonEmptyEnum2::Foo(_) | NonEmptyEnum2::Bar => todo!() | @@ -294,7 +294,7 @@ LL | enum NonEmptyEnum5 { = note: the matched value is of type `NonEmptyEnum5` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ _ if false => {} +LL ~ _ if false => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index c926e50b3..d66d4ba29 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -7,7 +7,7 @@ LL | match 0.0 { = note: the matched value is of type `f64` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 0.0..=1.0 => {} +LL ~ 0.0..=1.0 => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/guards.stderr b/tests/ui/pattern/usefulness/guards.stderr index 0c1563c16..fc6748958 100644 --- a/tests/ui/pattern/usefulness/guards.stderr +++ b/tests/ui/pattern/usefulness/guards.stderr @@ -7,7 +7,7 @@ LL | match 0u8 { = note: the matched value is of type `u8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 128 ..= 255 if true => {} +LL ~ 128 ..= 255 if true => {}, LL + 128_u8..=u8::MAX => todo!() | diff --git a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr index f30ba05df..b585de206 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/exhaustiveness.stderr @@ -91,7 +91,7 @@ LL | match 0i8 { = note: the matched value is of type `i8` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 1 ..= i8::MAX => {} +LL ~ 1 ..= i8::MAX => {}, LL + 0_i8 => todo!() | @@ -140,7 +140,7 @@ LL | match (0u8, true) { = note: the matched value is of type `(u8, bool)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ (0 ..= 255, true) => {} +LL ~ (0 ..= 255, true) => {}, LL + (126_u8..=127_u8, false) => todo!() | diff --git a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr index e3eb98ccd..0e0f0c3e1 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/pointer-sized-int.deny.stderr @@ -9,7 +9,7 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 0 ..= usize::MAX => {} +LL ~ 0 ..= usize::MAX => {}, LL + _ => todo!() | @@ -24,7 +24,7 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ isize::MIN ..= isize::MAX => {} +LL ~ isize::MIN ..= isize::MAX => {}, LL + _ => todo!() | @@ -147,7 +147,7 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 1 ..= isize::MAX => {} +LL ~ 1 ..= isize::MAX => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr index 30492c982..b80411b26 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/precise_pointer_matching-message.stderr @@ -9,7 +9,7 @@ LL | match 0usize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `usize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ 0..=usize::MAX => {} +LL ~ 0..=usize::MAX => {}, LL + _ => todo!() | @@ -24,7 +24,7 @@ LL | match 0isize { = help: add `#![feature(precise_pointer_size_matching)]` to the crate attributes to enable precise `isize` matching help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ isize::MIN..=isize::MAX => {} +LL ~ isize::MIN..=isize::MAX => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-2111.stderr b/tests/ui/pattern/usefulness/issue-2111.stderr index 01890b73c..7f7c5a0f1 100644 --- a/tests/ui/pattern/usefulness/issue-2111.stderr +++ b/tests/ui/pattern/usefulness/issue-2111.stderr @@ -7,7 +7,7 @@ LL | match (a, b) { = note: the matched value is of type `(Option<usize>, Option<usize>)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ (Some(_), None) | (None, Some(_)) => {} +LL ~ (Some(_), None) | (None, Some(_)) => {}, LL + (None, None) | (Some(_), Some(_)) => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-30240.stderr b/tests/ui/pattern/usefulness/issue-30240.stderr index 759fdeafe..ff755d681 100644 --- a/tests/ui/pattern/usefulness/issue-30240.stderr +++ b/tests/ui/pattern/usefulness/issue-30240.stderr @@ -7,7 +7,7 @@ LL | match "world" { = note: the matched value is of type `&str` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ "hello" => {} +LL ~ "hello" => {}, LL + &_ => todo!() | @@ -20,7 +20,7 @@ LL | match "world" { = note: the matched value is of type `&str` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ "hello" => {} +LL ~ "hello" => {}, LL + &_ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-35609.stderr b/tests/ui/pattern/usefulness/issue-35609.stderr index 12113957d..6d5e2f410 100644 --- a/tests/ui/pattern/usefulness/issue-35609.stderr +++ b/tests/ui/pattern/usefulness/issue-35609.stderr @@ -7,7 +7,7 @@ LL | match (A, ()) { = note: the matched value is of type `(Enum, ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ (A, _) => {} +LL ~ (A, _) => {}, LL + _ => todo!() | @@ -20,7 +20,7 @@ LL | match (A, A) { = note: the matched value is of type `(Enum, Enum)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ (_, A) => {} +LL ~ (_, A) => {}, LL + _ => todo!() | @@ -33,7 +33,7 @@ LL | match ((A, ()), ()) { = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ ((A, ()), _) => {} +LL ~ ((A, ()), _) => {}, LL + _ => todo!() | @@ -46,7 +46,7 @@ LL | match ((A, ()), A) { = note: the matched value is of type `((Enum, ()), Enum)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ ((A, ()), _) => {} +LL ~ ((A, ()), _) => {}, LL + _ => todo!() | @@ -59,7 +59,7 @@ LL | match ((A, ()), ()) { = note: the matched value is of type `((Enum, ()), ())` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ ((A, _), _) => {} +LL ~ ((A, _), _) => {}, LL + _ => todo!() | @@ -77,7 +77,7 @@ LL | struct S(Enum, ()); = note: the matched value is of type `S` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ S(A, _) => {} +LL ~ S(A, _) => {}, LL + _ => todo!() | @@ -95,7 +95,7 @@ LL | struct Sd { x: Enum, y: () } = note: the matched value is of type `Sd` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ Sd { x: A, y: _ } => {} +LL ~ Sd { x: A, y: _ } => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-3601.stderr b/tests/ui/pattern/usefulness/issue-3601.stderr index 59d7bcd4b..2f6b167d4 100644 --- a/tests/ui/pattern/usefulness/issue-3601.stderr +++ b/tests/ui/pattern/usefulness/issue-3601.stderr @@ -9,7 +9,7 @@ note: `Box<ElementKind>` defined here = note: the matched value is of type `Box<ElementKind>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true } +LL ~ box ElementKind::HTMLImageElement(ref d) if d.image.is_some() => { true }, LL + box _ => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-50900.stderr b/tests/ui/pattern/usefulness/issue-50900.stderr index 348246d28..7880c8925 100644 --- a/tests/ui/pattern/usefulness/issue-50900.stderr +++ b/tests/ui/pattern/usefulness/issue-50900.stderr @@ -12,7 +12,7 @@ LL | pub struct Tag(pub Context, pub u16); = note: the matched value is of type `Tag` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Tag::ExifIFDPointer => {} +LL ~ Tag::ExifIFDPointer => {}, LL + Tag(Context::Exif, _) => todo!() | diff --git a/tests/ui/pattern/usefulness/issue-56379.stderr b/tests/ui/pattern/usefulness/issue-56379.stderr index 6eed6bfae..b3e40b992 100644 --- a/tests/ui/pattern/usefulness/issue-56379.stderr +++ b/tests/ui/pattern/usefulness/issue-56379.stderr @@ -18,7 +18,7 @@ LL | C(bool), = note: the matched value is of type `Foo` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ Foo::C(true) => {} +LL ~ Foo::C(true) => {}, LL + Foo::A(false) | Foo::B(false) | Foo::C(false) => todo!() | diff --git a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr index a90f32f7a..3c482eef2 100644 --- a/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr +++ b/tests/ui/pattern/usefulness/match-byte-array-patterns-2.stderr @@ -7,7 +7,7 @@ LL | match buf { = note: the matched value is of type `&[u8; 4]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ b"AAAA" => {} +LL ~ b"AAAA" => {}, LL + &[0_u8..=64_u8, _, _, _] | &[66_u8..=u8::MAX, _, _, _] => todo!() | @@ -20,7 +20,7 @@ LL | match buf { = note: the matched value is of type `&[u8]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown, or multiple match arms | -LL ~ b"AAAA" => {} +LL ~ b"AAAA" => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/match-privately-empty.stderr b/tests/ui/pattern/usefulness/match-privately-empty.stderr index 86f75d15c..45352f094 100644 --- a/tests/ui/pattern/usefulness/match-privately-empty.stderr +++ b/tests/ui/pattern/usefulness/match-privately-empty.stderr @@ -12,7 +12,7 @@ note: `Option<Private>` defined here = note: the matched value is of type `Option<Private>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ }) => {} +LL ~ }) => {}, LL + Some(Private { misc: true, .. }) => todo!() | diff --git a/tests/ui/pattern/usefulness/match-slice-patterns.stderr b/tests/ui/pattern/usefulness/match-slice-patterns.stderr index 961dd5901..63d1f38e9 100644 --- a/tests/ui/pattern/usefulness/match-slice-patterns.stderr +++ b/tests/ui/pattern/usefulness/match-slice-patterns.stderr @@ -7,7 +7,7 @@ LL | match list { = note: the matched value is of type `&[Option<()>]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ &[.., Some(_), _] => {} +LL ~ &[.., Some(_), _] => {}, LL ~ &[_, Some(_), .., None, _] => todo!(), | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr index 769d4070f..8489e2f14 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-defined-here.stderr @@ -18,7 +18,7 @@ LL | C = note: the matched value is of type `E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ E::A => {} +LL ~ E::A => {}, LL + E::B | E::C => todo!() | @@ -44,8 +44,8 @@ LL | C = note: the matched value is of type `E` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let E::A = e { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let E::A = e { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `&E::B` and `&E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:50:11 @@ -67,7 +67,7 @@ LL | C = note: the matched value is of type `&E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ E::A => {} +LL ~ E::A => {}, LL + &E::B | &E::C => todo!() | @@ -93,8 +93,8 @@ LL | C = note: the matched value is of type `&E` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let E::A = e { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let E::A = e { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `&&mut &E::B` and `&&mut &E::C` not covered --> $DIR/non-exhaustive-defined-here.rs:66:11 @@ -116,7 +116,7 @@ LL | C = note: the matched value is of type `&&mut &E` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ E::A => {} +LL ~ E::A => {}, LL + &&mut &E::B | &&mut &E::C => todo!() | @@ -142,8 +142,8 @@ LL | C = note: the matched value is of type `&&mut &E` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let E::A = e { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let E::A = e { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `Opt::None` not covered --> $DIR/non-exhaustive-defined-here.rs:92:11 @@ -162,7 +162,7 @@ LL | None, = note: the matched value is of type `Opt` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ Opt::Some(ref _x) => {} +LL ~ Opt::Some(ref _x) => {}, LL + Opt::None => todo!() | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr index 44f327421..98e417a17 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match-nested.stderr @@ -25,7 +25,7 @@ LL | enum T { A(U), B } = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ T::B => { panic!("goodbye"); } +LL ~ T::B => { panic!("goodbye"); }, LL + T::A(U::C) => todo!() | diff --git a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr index e2260f50b..e59e8885e 100644 --- a/tests/ui/pattern/usefulness/non-exhaustive-match.stderr +++ b/tests/ui/pattern/usefulness/non-exhaustive-match.stderr @@ -24,7 +24,7 @@ LL | match true { = note: the matched value is of type `bool` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ true => {} +LL ~ true => {}, LL + false => todo!() | @@ -42,7 +42,7 @@ note: `Option<i32>` defined here = note: the matched value is of type `Option<i32>` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ None => {} +LL ~ None => {}, LL + Some(_) => todo!() | @@ -55,7 +55,7 @@ LL | match (2, 3, 4) { = note: the matched value is of type `(i32, i32, i32)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ (_, _, 4) => {} +LL ~ (_, _, 4) => {}, LL + (_, _, i32::MIN..=3_i32) | (_, _, 5_i32..=i32::MAX) => todo!() | @@ -68,7 +68,7 @@ LL | match (T::A, T::A) { = note: the matched value is of type `(T, T)` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ (T::B, T::A) => {} +LL ~ (T::B, T::A) => {}, LL + (T::A, T::A) | (T::B, T::B) => todo!() | @@ -86,7 +86,7 @@ LL | enum T { A, B } = note: the matched value is of type `T` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ T::A => {} +LL ~ T::A => {}, LL + T::B => todo!() | @@ -99,7 +99,7 @@ LL | match *vec { = note: the matched value is of type `[Option<isize>]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [None] => {} +LL ~ [None] => {}, LL + [] => todo!() | diff --git a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr index c518de477..beb51a4d4 100644 --- a/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr +++ b/tests/ui/pattern/usefulness/refutable-pattern-errors.stderr @@ -17,8 +17,8 @@ LL | let (1, (Some(1), 2..=3)) = (1, (None, 2)); = note: the matched value is of type `(i32, (Option<i32>, i32))` help: you might want to use `if let` to ignore the variants that aren't matched | -LL | if let (1, (Some(1), 2..=3)) = (1, (None, 2)) { todo!() } - | ++ ~~~~~~~~~~~ +LL | if let (1, (Some(1), 2..=3)) = (1, (None, 2)) { todo!() }; + | ++ +++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr index 55f0b2319..ab3f6f69f 100644 --- a/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr +++ b/tests/ui/pattern/usefulness/refutable-pattern-in-fn-arg.stderr @@ -5,6 +5,10 @@ LL | let f = |3: isize| println!("hello"); | ^ pattern `_` not covered | = note: the matched value is of type `isize` +help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits + | +LL | let f = |_3: isize| println!("hello"); + | + error: aborting due to previous error diff --git a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr index 5d1e170ae..fb6ecda3c 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr +++ b/tests/ui/pattern/usefulness/slice-patterns-exhaustiveness.stderr @@ -7,7 +7,7 @@ LL | match s2 { = note: the matched value is of type `&[bool; 2]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, .., true] => {} +LL ~ [true, .., true] => {}, LL + &[false, _] => todo!() | @@ -20,7 +20,7 @@ LL | match s3 { = note: the matched value is of type `&[bool; 3]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, .., true] => {} +LL ~ [true, .., true] => {}, LL + &[false, ..] => todo!() | @@ -33,7 +33,7 @@ LL | match s10 { = note: the matched value is of type `&[bool; 10]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, .., true] => {} +LL ~ [true, .., true] => {}, LL + &[false, ..] => todo!() | @@ -46,7 +46,7 @@ LL | match s2 { = note: the matched value is of type `&[bool; 2]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[false, true] => todo!() | @@ -59,7 +59,7 @@ LL | match s3 { = note: the matched value is of type `&[bool; 3]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[false, .., true] => todo!() | @@ -72,7 +72,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[false, .., true] => todo!() | @@ -85,7 +85,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [] => {} +LL ~ [] => {}, LL + &[_, ..] => todo!() | @@ -98,7 +98,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [_] => {} +LL ~ [_] => {}, LL + &[_, _, ..] => todo!() | @@ -111,7 +111,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, ..] => {} +LL ~ [true, ..] => {}, LL + &[false, ..] => todo!() | @@ -124,7 +124,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [true, ..] => {} +LL ~ [true, ..] => {}, LL + &[false, _, ..] => todo!() | @@ -137,7 +137,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., true] => {} +LL ~ [.., true] => {}, LL + &[_, .., false] => todo!() | @@ -150,7 +150,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [.., false] => {} +LL ~ [.., false] => {}, LL + &[_, _, .., true] => todo!() | @@ -163,7 +163,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ [false, .., false] => {} +LL ~ [false, .., false] => {}, LL + &[true, _, .., _] => todo!() | @@ -176,7 +176,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ &[true] => {} +LL ~ &[true] => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -189,7 +189,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ CONST => {} +LL ~ CONST => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -202,7 +202,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ &[false] => {} +LL ~ &[false] => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -215,7 +215,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ CONST => {} +LL ~ CONST => {}, LL + &[] | &[_, _, ..] => todo!() | @@ -228,7 +228,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ CONST => {} +LL ~ CONST => {}, LL + &[_, _, ..] => todo!() | @@ -241,7 +241,7 @@ LL | match s { = note: the matched value is of type `&[bool]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ &[_, _, ..] => {} +LL ~ &[_, _, ..] => {}, LL + &[false] => todo!() | @@ -254,7 +254,7 @@ LL | match s1 { = note: the matched value is of type `&[bool; 1]` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ CONST1 => {} +LL ~ CONST1 => {}, LL + &[false] => todo!() | diff --git a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr index 7b8588a3c..f944c25a9 100644 --- a/tests/ui/pattern/usefulness/stable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-patterns.stderr @@ -15,7 +15,7 @@ LL | Stable2, = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms | -LL ~ UnstableEnum::Stable => {} +LL ~ UnstableEnum::Stable => {}, LL + UnstableEnum::Stable2 | _ => todo!() | @@ -33,7 +33,7 @@ LL | pub enum UnstableEnum { = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ UnstableEnum::Stable2 => {} +LL ~ UnstableEnum::Stable2 => {}, LL + _ => todo!() | diff --git a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr index 85c97be29..22425aa0d 100644 --- a/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr +++ b/tests/ui/pattern/usefulness/struct-like-enum-nonexhaustive.stderr @@ -14,7 +14,7 @@ LL | B { x: Option<isize> }, = note: the matched value is of type `A` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ A::B { x: None } => {} +LL ~ A::B { x: None } => {}, LL + A::B { x: Some(_) } => todo!() | diff --git a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr index 6dc9a4058..d776249b2 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-patterns.stderr @@ -15,7 +15,7 @@ LL | Unstable, = note: the matched value is of type `UnstableEnum` help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown | -LL ~ UnstableEnum::Stable2 => {} +LL ~ UnstableEnum::Stable2 => {}, LL + UnstableEnum::Unstable => todo!() | |