From f48194ea5578802c786edff59dd72388da0e6305 Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Tue, 1 Oct 2024 08:55:10 +1000 Subject: Replace -Z default-hidden-visibility with -Z default-visibility MCP: https://github.com/rust-lang/compiler-team/issues/782 Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com> --- tests/codegen/default-hidden-visibility.rs | 31 ---------------------------- tests/codegen/default-visibility.rs | 33 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 31 deletions(-) delete mode 100644 tests/codegen/default-hidden-visibility.rs create mode 100644 tests/codegen/default-visibility.rs (limited to 'tests/codegen') diff --git a/tests/codegen/default-hidden-visibility.rs b/tests/codegen/default-hidden-visibility.rs deleted file mode 100644 index 2bea8f62a40..00000000000 --- a/tests/codegen/default-hidden-visibility.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Verifies that `Session::default_hidden_visibility` is affected when using the related cmdline -// flag. This is a regression test for https://github.com/rust-lang/compiler-team/issues/656. See -// also https://github.com/rust-lang/rust/issues/73295 and -// https://github.com/rust-lang/rust/issues/37530. - -//@ revisions:DEFAULT YES NO -//@[YES] compile-flags: -Zdefault-hidden-visibility=yes -//@[NO] compile-flags: -Zdefault-hidden-visibility=no - -// The test scenario is specifically about visibility of symbols exported out of dynamically linked -// libraries. -#![crate_type = "dylib"] - -// The test scenario needs to use a Rust-public, but non-explicitly-exported symbol -// (e.g. the test doesn't use `#[no_mangle]`, because currently it implies that -// the symbol should be exported; we don't want that - we want to test the *default* -// export setting instead). -#[used] -pub static tested_symbol: [u8; 6] = *b"foobar"; - -// Exact LLVM IR differs depending on the target triple (e.g. `hidden constant` -// vs `internal constant` vs `constant`). Because of this, we only apply the -// specific test expectations below to one specific target triple. If needed, -// additional targets can be covered by adding copies of this test file with -// a different `only-X` directive. -// -//@ only-x86_64-unknown-linux-gnu - -// DEFAULT: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = constant -// YES: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = hidden constant -// NO: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = constant diff --git a/tests/codegen/default-visibility.rs b/tests/codegen/default-visibility.rs new file mode 100644 index 00000000000..884d386ec20 --- /dev/null +++ b/tests/codegen/default-visibility.rs @@ -0,0 +1,33 @@ +// Verifies that `Session::default_visibility` is affected when using the related cmdline +// flag. This is a regression test for https://github.com/rust-lang/compiler-team/issues/782. See +// also https://github.com/rust-lang/rust/issues/73295 and +// https://github.com/rust-lang/rust/issues/37530. + +//@ revisions:DEFAULT HIDDEN PROTECTED INTERPOSABLE +//@[HIDDEN] compile-flags: -Zdefault-visibility=hidden +//@[PROTECTED] compile-flags: -Zdefault-visibility=protected +//@[INTERPOSABLE] compile-flags: -Zdefault-visibility=interposable + +// The test scenario is specifically about visibility of symbols exported out of dynamically linked +// libraries. +#![crate_type = "dylib"] + +// The test scenario needs to use a Rust-public, but non-explicitly-exported symbol +// (e.g. the test doesn't use `#[no_mangle]`, because currently it implies that +// the symbol should be exported; we don't want that - we want to test the *default* +// export setting instead). +#[used] +pub static tested_symbol: [u8; 6] = *b"foobar"; + +// Exact LLVM IR differs depending on the target triple (e.g. `hidden constant` +// vs `internal constant` vs `constant`). Because of this, we only apply the +// specific test expectations below to one specific target triple. If needed, +// additional targets can be covered by adding copies of this test file with +// a different `only-X` directive. +// +//@ only-x86_64-unknown-linux-gnu + +// HIDDEN: @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = hidden constant +// PROTECTED: @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = protected constant +// INTERPOSABLE: @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = constant +// DEFAULT: @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = constant -- cgit 1.4.1-3-g733a5