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