summaryrefslogtreecommitdiffstats
path: root/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.rs')
-rw-r--r--src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.rs48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.rs b/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.rs
deleted file mode 100644
index a6144c949..000000000
--- a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-fn main() {}
-
-struct U;
-
-fn slice() {
- let mut arr = [U, U, U, U, U];
- let hold_all = &arr;
- let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; //~ ERROR cannot move out of `arr[..]`
- _x1 = U; //~ ERROR cannot assign twice to immutable variable `_x1`
- drop(hold_all);
- let [_x0, ..] = arr; //~ ERROR cannot move out of `arr[..]`
- drop(_x0_hold);
- let [_, _, ref mut _x2, _x3, mut _x4] = arr;
- //~^ ERROR cannot borrow `arr[..]` as mutable
- //~| ERROR cannot move out of `arr[..]` because it is borrowed
- //~| ERROR cannot move out of `arr[..]` because it is borrowed
- drop(xs_hold);
-}
-
-fn tuple() {
- let mut tup = (U, U, U, U);
- let (ref _x0, _x1, ref _x2, ..) = tup;
- _x1 = U; //~ ERROR cannot assign twice to immutable variable
- let _x0_hold = &mut tup.0; //~ ERROR cannot borrow `tup.0` as mutable because it is also
- let (ref mut _x0_hold, ..) = tup; //~ ERROR cannot borrow `tup.0` as mutable because it is also
- *_x0 = U; //~ ERROR cannot assign to `*_x0`, which is behind a `&` reference
- *_x2 = U; //~ ERROR cannot assign to `*_x2`, which is behind a `&` reference
- drop(tup.1); //~ ERROR use of moved value: `tup.1`
- let _x1_hold = &tup.1; //~ ERROR borrow of moved value: `tup.1`
- let (.., ref mut _x3) = tup;
- let _x3_hold = &tup.3; //~ ERROR cannot borrow `tup.3` as immutable
- let _x3_hold = &mut tup.3; //~ ERROR cannot borrow `tup.3` as mutable more
- let (.., ref mut _x4_hold) = tup; //~ ERROR cannot borrow `tup.3` as mutable more
- let (.., ref _x4_hold) = tup; //~ ERROR cannot borrow `tup.3` as immutable
- drop(_x3);
-}
-
-fn closure() {
- let mut tup = (U, U, U);
- let c1 = || {
- let (ref _x0, _x1, _) = tup;
- };
- let c2 = || {
- //~^ ERROR use of moved value
- let (ref mut _x0, _, _x2) = tup;
- };
- drop(c1);
-}