File: borrowck-move-out-from-array-no-overlap.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (67 lines) | stat: -rw-r--r-- 1,286 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//@ check-pass

fn array() -> [(String, String); 3] {
    Default::default()
}

// Const Index + Const Index

fn move_out_from_begin_and_one_from_end() {
    let a = array();
    let [_, _, _x] = a;
    let [.., _y, _] = a;
}

fn move_out_from_begin_field_and_end_field() {
    let a = array();
    let [_, _, (_x, _)] = a;
    let [.., (_, _y)] = a;
}

// Const Index + Slice

fn move_out_by_const_index_and_subslice() {
    let a = array();
    let [_x, _, _] = a;
    let [_, _y @ ..] = a;
}

fn move_out_by_const_index_end_and_subslice() {
    let a = array();
    let [.., _x] = a;
    let [_y @ .., _] = a;
}

fn move_out_by_const_index_field_and_subslice() {
    let a = array();
    let [(_x, _), _, _] = a;
    let [_, _y @ ..] = a;
}

fn move_out_by_const_index_end_field_and_subslice() {
    let a = array();
    let [.., (_x, _)] = a;
    let [_y @ .., _] = a;
}

fn move_out_by_const_subslice_and_index_field() {
    let a = array();
    let [_, _y @ ..] = a;
    let [(_x, _), _, _] = a;
}

fn move_out_by_const_subslice_and_end_index_field() {
    let a = array();
    let [_y @ .., _] = a;
    let [.., (_x, _)] = a;
}

// Slice + Slice

fn move_out_by_subslice_and_subslice() {
    let a = array();
    let [x @ .., _, _] = a;
    let [_, _y @ ..] = a;
}

fn main() {}