]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/struct_add_field.rs
Auto merge of #33312 - Byron:double-ended-iterator-for-args, r=alexcrichton
[rust.git] / src / test / incremental / struct_add_field.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Test incremental compilation tracking where we change field names
12 // in between revisions (hashing should be stable).
13
14 // revisions:rpass1 rpass2
15
16 #![feature(rustc_attrs)]
17
18 pub struct X {
19     pub x: u32,
20
21     #[cfg(rpass2)]
22     pub x2: u32,
23 }
24
25 pub struct EmbedX {
26     x: X
27 }
28
29 pub struct Y {
30     pub y: char
31 }
32
33 #[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
34 pub fn use_X(x: X) -> u32 {
35     x.x as u32
36 }
37
38 #[rustc_dirty(label="TypeckItemBody", cfg="rpass2")]
39 pub fn use_EmbedX(embed: EmbedX) -> u32 {
40     embed.x.x as u32
41 }
42
43 #[rustc_clean(label="TypeckItemBody", cfg="rpass2")]
44 pub fn use_Y() {
45     let x: Y = Y { y: 'c' };
46 }
47
48 pub fn main() { }