about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-03 23:50:01 +0000
committerbors <bors@rust-lang.org>2020-04-03 23:50:01 +0000
commit9e55101bb681010c82c3c827305e2665fc8f2aa0 (patch)
treeb08b1e7393e70a5f41a3c6cb38a568ccf8c0c8ec /src/test
parent74bd074eefcf4915c73d1ab91bc90859664729e6 (diff)
parent98ead3e636acf311dbc353a787be3788c12bd9e0 (diff)
downloadrust-9e55101bb681010c82c3c827305e2665fc8f2aa0.tar.gz
rust-9e55101bb681010c82c3c827305e2665fc8f2aa0.zip
Auto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakis
Make the rustc respect the `-C codegen-units` flag in incremental mode.

This PR implements (the as of yet unapproved) major change proposal at https://github.com/rust-lang/compiler-team/issues/245. See the description there for background and rationale.

The changes are pretty straightforward and should be easy to rebase if the proposal gets accepted at some point.

r? @nikomatsakis cc @pnkfelix
Diffstat (limited to 'src/test')
-rw-r--r--src/test/codegen-units/partitioning/incremental-merging.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/codegen-units/partitioning/incremental-merging.rs b/src/test/codegen-units/partitioning/incremental-merging.rs
new file mode 100644
index 00000000000..ca2df19096e
--- /dev/null
+++ b/src/test/codegen-units/partitioning/incremental-merging.rs
@@ -0,0 +1,42 @@
+// ignore-tidy-linelength
+// We specify -C incremental here because we want to test the partitioning for
+// incremental compilation
+// compile-flags:-Zprint-mono-items=lazy -Cincremental=tmp/partitioning-tests/incremental-merging
+// compile-flags:-Ccodegen-units=3
+
+#![crate_type = "rlib"]
+
+// This test makes sure that merging of CGUs works together with incremental
+// compilation but at the same time does not modify names of CGUs that were not
+// affected by merging.
+//
+// We expect CGUs `aaa` and `bbb` to be merged (because they are the smallest),
+// while `ccc` and `ddd` are supposed to stay untouched.
+
+pub mod aaa {
+    //~ MONO_ITEM fn incremental_merging::aaa[0]::foo[0] @@ incremental_merging-aaa--incremental_merging-bbb[External]
+    pub fn foo(a: u64) -> u64 {
+        a + 1
+    }
+}
+
+pub mod bbb {
+    //~ MONO_ITEM fn incremental_merging::bbb[0]::foo[0] @@ incremental_merging-aaa--incremental_merging-bbb[External]
+    pub fn foo(a: u64, b: u64) -> u64 {
+        a + b + 1
+    }
+}
+
+pub mod ccc {
+    //~ MONO_ITEM fn incremental_merging::ccc[0]::foo[0] @@ incremental_merging-ccc[External]
+    pub fn foo(a: u64, b: u64, c: u64) -> u64 {
+        a + b + c + 1
+    }
+}
+
+pub mod ddd {
+    //~ MONO_ITEM fn incremental_merging::ddd[0]::foo[0] @@ incremental_merging-ddd[External]
+    pub fn foo(a: u64, b: u64, c: u64, d: u64) -> u64 {
+        a + b + c + d + 1
+    }
+}