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