]> git.lizzy.rs Git - rust.git/blob - tests/incremental/struct_change_field_name.rs
Rollup merge of #107317 - ids1024:asfd-rc, r=dtolnay
[rust.git] / tests / 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 // [cfail2] compile-flags: -Z query-dep-graph -Z assert-incr-state=loaded
7
8 #![feature(rustc_attrs)]
9
10 #[cfg(rpass1)]
11 pub struct X {
12     pub x: u32
13 }
14
15 #[cfg(cfail2)]
16 pub struct X {
17     pub y: u32
18 }
19
20 pub struct EmbedX {
21     x: X
22 }
23
24 pub struct Y {
25     pub y: char
26 }
27
28 #[rustc_clean(except="typeck", cfg="cfail2")]
29 pub fn use_X() -> u32 {
30     let x: X = X { x: 22 };
31     //[cfail2]~^ ERROR struct `X` has no field named `x`
32     x.x as u32
33     //[cfail2]~^ ERROR no field `x` on type `X`
34 }
35
36 #[rustc_clean(except="typeck", cfg="cfail2")]
37 pub fn use_EmbedX(embed: EmbedX) -> u32 {
38     embed.x.x as u32
39     //[cfail2]~^ ERROR no field `x` on type `X`
40 }
41
42 #[rustc_clean(cfg="cfail2")]
43 pub fn use_Y() {
44     let x: Y = Y { y: 'c' };
45 }
46
47 pub fn main() { }