]> git.proxmox.com Git - rustc.git/blob - src/test/incremental/change_symbol_export_status.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / incremental / change_symbol_export_status.rs
1 // revisions: rpass1 rpass2
2 // compile-flags: -Zquery-dep-graph
3
4 #![feature(rustc_attrs)]
5 #![rustc_partition_codegened(module = "change_symbol_export_status-mod1", cfg = "rpass2")]
6 #![rustc_partition_reused(module = "change_symbol_export_status-mod2", cfg = "rpass2")]
7
8 // This test case makes sure that a change in symbol visibility is detected by
9 // our dependency tracking. We do this by changing a module's visibility to
10 // `private` in rpass2, causing the contained function to go from `default` to
11 // `hidden` visibility.
12 // The function is marked with #[no_mangle] so it is considered for exporting
13 // even from an executable. Plain Rust functions are only exported from Rust
14 // libraries, which our test infrastructure does not support.
15
16 #[cfg(rpass1)]
17 pub mod mod1 {
18 #[no_mangle]
19 pub fn foo() {}
20 }
21
22 #[cfg(rpass2)]
23 mod mod1 {
24 #[no_mangle]
25 pub fn foo() {}
26 }
27
28 pub mod mod2 {
29 #[no_mangle]
30 pub fn bar() {}
31 }
32
33 fn main() {
34 mod1::foo();
35 }