]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/non-existent-field-present-in-subfield-recursion-limit.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / non-existent-field-present-in-subfield-recursion-limit.rs
1 // In rustc_hir_analysis::check::expr::no_such_field_err we recursively
2 // look in subfields for the field. This recursive search is limited
3 // in depth for compile-time reasons and to avoid infinite recursion
4 // in case of cycles. This file tests that the limit in the recursion
5 // depth is enforced.
6
7 struct Foo {
8     first: Bar,
9     second: u32,
10     third: u32,
11 }
12
13 struct Bar {
14     bar: C,
15 }
16
17 struct C {
18     c: D,
19 }
20
21 struct D {
22     test: E,
23 }
24
25 struct E {
26     e: F,
27 }
28
29 struct F {
30     f: u32,
31 }
32
33 fn main() {
34     let f = F { f: 6 };
35     let e = E { e: f };
36     let d = D { test: e };
37     let c = C { c: d };
38     let bar = Bar { bar: c };
39     let fooer = Foo { first: bar, second: 4, third: 5 };
40
41     let test = fooer.f;
42     //~^ ERROR no field
43 }