about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-12-11 18:20:52 +0000
committerbors <bors@rust-lang.org>2016-12-11 18:20:52 +0000
commit6d5ec58912b84e2ba82bb483bf1f25af824c4297 (patch)
treec09fed4b176e3e0ac8ef80fa3ef7228a63ac221d /src/test
parentfd5dc057936f5d84ccd8c1d5965f60e669b589d8 (diff)
parent90f0de8244c6d25eab841b0e24caff842ec90539 (diff)
Auto merge of #38272 - michaelwoerister:incr-symbol-visibility, r=nikomatsakis
incr.comp.: Take symbol visibility into account for CGU hashes

r? @nikomatsakis
Diffstat (limited to 'src/test')
-rw-r--r--src/test/incremental/change_symbol_export_status.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/incremental/change_symbol_export_status.rs b/src/test/incremental/change_symbol_export_status.rs
new file mode 100644
index 00000000000..71f46c641bf
--- /dev/null
+++ b/src/test/incremental/change_symbol_export_status.rs
@@ -0,0 +1,42 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: rpass1 rpass2
+
+#![feature(rustc_attrs)]
+#![allow(private_no_mangle_fns)]
+
+#![rustc_partition_reused(module="change_symbol_export_status", cfg="rpass2")]
+#![rustc_partition_translated(module="change_symbol_export_status-mod1", cfg="rpass2")]
+
+
+// This test case makes sure that a change in symbol visibility is detected by
+// our dependency tracking. We do this by changing a module's visibility to
+// `private` in rpass2, causing the contained function to go from `default` to
+// `hidden` visibility.
+// The function is marked with #[no_mangle] so it is considered for exporting
+// even from an executable. Plain Rust functions are only exported from Rust
+// libraries, which our test infrastructure does not support.
+
+#[cfg(rpass1)]
+pub mod mod1 {
+    #[no_mangle]
+    pub fn foo() {}
+}
+
+#[cfg(rpass2)]
+mod mod1 {
+    #[no_mangle]
+    pub fn foo() {}
+}
+
+fn main() {
+    mod1::foo();
+}