summaryrefslogtreecommitdiffstats
path: root/tests/ui/destructuring-assignment/struct-or-enum-variant-path.rs
blob: f82e029983b753074e3eb87aa1e33fd022865b01 (plain)
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
// check-pass

struct S;

enum E {
    V,
}

type A = E;

fn main() {
    let mut a;

    S = S;
    (S, a) = (S, ());

    E::V = E::V;
    (E::V, a) = (E::V, ());

    <E>::V = E::V;
    (<E>::V, a) = (E::V, ());
    A::V = A::V;
    (A::V, a) = (E::V, ());
}

impl S {
    fn check() {
        let a;
        Self = S;
        (Self, a) = (S, ());
    }
}

impl E {
    fn check() {
        let a;
        Self::V = E::V;
        (Self::V, a) = (E::V, ());
    }
}