Skip to content

Commit c181b37

Browse files
committed
Ignore unrelated attributes in the default-hidden-visibility test.
Before this commit the difference between `internal constant` vs `constant` could lead to a test failure, even though both of these combinations have no `hidden` attribute (and presence of the `hidden` attribute is ultimately the only aspect that the test should care about).
1 parent 731c2dc commit c181b37

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/codegen/default-hidden-visibility.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
//
1919
// ignore-wasm32
2020

21+
// We verify that using the command line marks the `exported_symbol` as `hidden`
22+
// and that it is not `hidden` otherwise. We don't verify other attributes of
23+
// the symbol, because they vary depending on the target (e.g. in the `DEFAULT`
24+
// behavior on `i686-unknown-linux-musl` the symbol is `internal constant` while
25+
// on `x86_64-unknown-linux-gnu` it is just `constant`).
26+
//
27+
// DEFAULT-NOT: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} ={{.*}} hidden
28+
// NO-NOT: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} ={{.*}} hidden
29+
// YES: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} ={{.*}} hidden
30+
2131
// The test scenario is specifically about visibility of symbols exported out of dynamically linked
2232
// libraries.
2333
#![crate_type = "dylib"]
@@ -26,11 +36,5 @@
2636
// (e.g. the test doesn't use `#[no_mangle]`, because currently it implies that
2737
// the symbol should be exported; we don't want that - we want to test the *default*
2838
// export setting instead).
29-
// .
30-
// We want to verify that the cmdline flag affects the visibility of this symbol:
31-
//
32-
// DEFAULT: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} = constant
33-
// YES: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} = hidden constant
34-
// NO: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} = constant
3539
#[used]
3640
pub static exported_symbol: [u8; 6] = *b"foobar";

0 commit comments

Comments
 (0)