]> git.lizzy.rs Git - rust.git/blob - src/test/incremental/change_symbol_export_status.rs
Rollup merge of #68422 - Centril:diverges-simplify, r=eddyb
[rust.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 #![allow(private_no_mangle_fns)]
6
7 #![rustc_partition_codegened(module="change_symbol_export_status-mod1", cfg="rpass2")]
8 #![rustc_partition_reused(module="change_symbol_export_status-mod2", cfg="rpass2")]
9
10 // This test case makes sure that a change in symbol visibility is detected by
11 // our dependency tracking. We do this by changing a module's visibility to
12 // `private` in rpass2, causing the contained function to go from `default` to
13 // `hidden` visibility.
14 // The function is marked with #[no_mangle] so it is considered for exporting
15 // even from an executable. Plain Rust functions are only exported from Rust
16 // libraries, which our test infrastructure does not support.
17
18 #[cfg(rpass1)]
19 pub mod mod1 {
20     #[no_mangle]
21     pub fn foo() {}
22 }
23
24 #[cfg(rpass2)]
25 mod mod1 {
26     #[no_mangle]
27     pub fn foo() {}
28 }
29
30 pub mod mod2 {
31     #[no_mangle]
32     pub fn bar() {}
33 }
34
35 fn main() {
36     mod1::foo();
37 }