]> git.lizzy.rs Git - rust.git/blob - src/test/codegen-units/partitioning/incremental-merging.rs
Add a test case for incremental + codegen-units interaction.
[rust.git] / src / test / codegen-units / partitioning / incremental-merging.rs
1 // ignore-tidy-linelength
2 // We specify -C incremental here because we want to test the partitioning for
3 // incremental compilation
4 // compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/incremental-merging
5 // compile-flags:-Ccodegen-units=3
6
7 #![crate_type = "rlib"]
8
9 // This test makes sure that merging of CGUs works together with incremental
10 // compilation but at the same time does not modify names of CGUs that were not
11 // affected by merging.
12 //
13 // We expect CGUs `aaa` and `bbb` to be merged (because they are the smallest),
14 // while `ccc` and `ddd` are supposed to stay untouched.
15
16 pub mod aaa {
17     //~ MONO_ITEM fn incremental_merging::aaa[0]::foo[0] @@ incremental_merging-aaa--incremental_merging-bbb[External]
18     pub fn foo(a: u64) -> u64 {
19         a + 1
20     }
21 }
22
23 pub mod bbb {
24     //~ MONO_ITEM fn incremental_merging::bbb[0]::foo[0] @@ incremental_merging-aaa--incremental_merging-bbb[External]
25     pub fn foo(a: u64, b: u64) -> u64 {
26         a + b + 1
27     }
28 }
29
30 pub mod ccc {
31     //~ MONO_ITEM fn incremental_merging::ccc[0]::foo[0] @@ incremental_merging-ccc[External]
32     pub fn foo(a: u64, b: u64, c: u64) -> u64 {
33         a + b + c + 1
34     }
35 }
36
37 pub mod ddd {
38     //~ MONO_ITEM fn incremental_merging::ddd[0]::foo[0] @@ incremental_merging-ddd[External]
39     pub fn foo(a: u64, b: u64, c: u64, d: u64) -> u64 {
40         a + b + c + d + 1
41     }
42 }