summaryrefslogtreecommitdiffstats
path: root/src/test/ui/suggestions/non-existent-field-present-in-subfield.rs
blob: 7e273ac23d8c3828167a263459aaac4b9521abc7 (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
41
42
// run-rustfix

struct Foo {
    first: Bar,
    _second: u32,
    _third: Vec<String>,
}

struct Bar {
    bar: C,
}

struct C {
    c: D,
}

struct D {
    test: E,
}

struct E {
    _e: F,
}

struct F {
    _f: u32,
}

fn main() {
    let f = F { _f: 6 };
    let e = E { _e: f };
    let d = D { test: e };
    let c = C { c: d };
    let bar = Bar { bar: c };
    let fooer = Foo { first: bar, _second: 4, _third: Vec::new() };

    let _test = &fooer.c;
    //~^ ERROR no field

    let _test2 = fooer.test;
    //~^ ERROR no field
}