]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs
Auto merge of #54251 - varkor:silence-bad_style, r=Manishearth
[rust.git] / src / test / incremental / thinlto / independent_cgus_dont_affect_each_other.rs
1 // Copyright 2018 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
12 // This test checks that a change in a CGU does not invalidate an unrelated CGU
13 // during incremental ThinLTO.
14
15 // revisions: cfail1 cfail2 cfail3
16 // compile-flags: -Z query-dep-graph -O
17 // compile-pass
18
19 #![feature(rustc_attrs)]
20 #![crate_type="rlib"]
21
22 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
23                             cfg="cfail2",
24                             kind="no")]
25 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-foo",
26                             cfg="cfail3",
27                             kind="post-lto")]
28
29 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
30                             cfg="cfail2",
31                             kind="pre-lto")]
32 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
33                             cfg="cfail3",
34                             kind="post-lto")]
35
36 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
37                             cfg="cfail2",
38                             kind="post-lto")]
39 #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-baz",
40                             cfg="cfail3",
41                             kind="post-lto")]
42 mod foo {
43
44     #[cfg(cfail1)]
45     pub fn inlined_fn() -> u32 {
46         1234
47     }
48
49     #[cfg(not(cfail1))]
50     pub fn inlined_fn() -> u32 {
51         1234
52     }
53 }
54
55 pub mod bar {
56     use foo::inlined_fn;
57
58     pub fn caller() -> u32 {
59         inlined_fn()
60     }
61 }
62
63 pub mod baz {
64     pub fn unrelated_to_other_fns() -> u64 {
65         0xbeef
66     }
67 }