]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/struct_change_field_name.rs
Auto merge of #74060 - kpp:remove_length_at_most_32, r=dtolnay
[rust.git] / src / test / incremental / struct_change_field_name.rs
1 // Test incremental compilation tracking where we change field names
2 // in between revisions (hashing should be stable).
3
4 // revisions:rpass1 cfail2
5 // compile-flags: -Z query-dep-graph
6
7 #![feature(rustc_attrs)]
8
9 #[cfg(rpass1)]
10 pub struct X {
11     pub x: u32
12 }
13
14 #[cfg(cfail2)]
15 pub struct X {
16     pub y: u32
17 }
18
19 pub struct EmbedX {
20     x: X
21 }
22
23 pub struct Y {
24     pub y: char
25 }
26
27 #[rustc_dirty(label="typeck", cfg="cfail2")]
28 pub fn use_X() -> u32 {
29     let x: X = X { x: 22 };
30     //[cfail2]~^ ERROR struct `X` has no field named `x`
31     x.x as u32
32     //[cfail2]~^ ERROR no field `x` on type `X`
33 }
34
35 #[rustc_dirty(label="typeck", cfg="cfail2")]
36 pub fn use_EmbedX(embed: EmbedX) -> u32 {
37     embed.x.x as u32
38     //[cfail2]~^ ERROR no field `x` on type `X`
39 }
40
41 #[rustc_clean(label="typeck", cfg="cfail2")]
42 pub fn use_Y() {
43     let x: Y = Y { y: 'c' };
44 }
45
46 pub fn main() { }