]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.rs
1 // Due to #53114, which causes a "read" of the `_` patterns,
2 // the borrow-checker refuses this code, while it should probably be allowed.
3 // Once the bug is fixed, the test, which is derived from a
4 // passing test for `let` statements, should become check-pass.
6 fn array() -> [(String
, String
); 3] {
10 // Const Index + Const Index
12 fn move_out_from_begin_and_one_from_end() {
18 //~^ ERROR use of partially moved value
23 fn move_out_from_begin_field_and_end_field() {
29 //~^ ERROR use of partially moved value
30 [.., (_
, ref _y
)] => {}
34 // Const Index + Slice
36 fn move_out_by_const_index_and_subslice() {
42 //~^ ERROR use of partially moved value
43 [_
, ref _y @
..] => {}
47 fn move_out_by_const_index_end_and_subslice() {
53 //~^ ERROR use of partially moved value
54 [ref _y @
.., _
] => {}
58 fn move_out_by_const_index_field_and_subslice() {
64 //~^ ERROR use of partially moved value
65 [_
, ref _y @
..] => {}
69 fn move_out_by_const_index_end_field_and_subslice() {
75 //~^ ERROR use of partially moved value
76 [ref _y @
.., _
] => {}
80 fn move_out_by_const_subslice_and_index_field() {
86 //~^ ERROR use of partially moved value
87 [(ref _x
, _
), _
, _
] => {}
91 fn move_out_by_const_subslice_and_end_index_field() {
97 //~^ ERROR use of partially moved value
98 [.., (ref _x
, _
)] => {}
104 fn move_out_by_subslice_and_subslice() {
110 //~^ ERROR use of partially moved value
111 [_
, ref _y @
..] => {}