]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs
Auto merge of #61392 - Zoxc:single-interner, r=eddyb
[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         1234
41     }
42 }
43
44 pub mod bar {
45     use foo::inlined_fn;
46
47     pub fn caller() -> u32 {
48         inlined_fn()
49     }
50 }
51
52 pub mod baz {
53     pub fn unrelated_to_other_fns() -> u64 {
54         0xbeef
55     }
56 }