]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs
Auto merge of #106442 - matthiaskrgr:rollup-wivf7gh, r=matthiaskrgr
[rust.git] / src / test / incremental / thinlto / independent_cgus_dont_affect_each_other.rs
1 // This test checks that a change in a CGU does not invalidate an unrelated CGU
2 // during incremental ThinLTO.
3
4 // revisions: cfail1 cfail2 cfail3
5 // compile-flags: -Z query-dep-graph -O
6 // build-pass (FIXME(62277): could be check-pass?)
7
8 #![feature(rustc_attrs)]
9 #![crate_type="rlib"]
10
11 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
12                             cfg="cfail2",
13                             kind="no")]
14 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
15                             cfg="cfail3",
16                             kind="post-lto")]
17
18 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
19                             cfg="cfail2",
20                             kind="pre-lto")]
21 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
22                             cfg="cfail3",
23                             kind="post-lto")]
24
25 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
26                             cfg="cfail2",
27                             kind="post-lto")]
28 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
29                             cfg="cfail3",
30                             kind="post-lto")]
31 mod foo {
32
33     #[cfg(cfail1)]
34     pub fn inlined_fn() -> u32 {
35         1234
36     }
37
38     #[cfg(not(cfail1))]
39     pub fn inlined_fn() -> u32 {
40         // See `cgu_keeps_identical_fn.rs` for why this is different
41         // from the other version of this function.
42         12345
43     }
44 }
45
46 pub mod bar {
47     use foo::inlined_fn;
48
49     pub fn caller() -> u32 {
50         inlined_fn()
51     }
52 }
53
54 pub mod baz {
55     pub fn unrelated_to_other_fns() -> u64 {
56         0xbeef
57     }
58 }