Skip to content

Conversation

@ladipro
Copy link

@ladipro ladipro commented Oct 24, 2025

Per discussion in #142742, this PR makes a couple of tests link in their helper crates statically. The compiletest's default is to prefer dynamic linking, which in these cases would exercise a problematic (unsupported?) scenario.

r? @bjorn3

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 24, 2025
@@ -1 +1,5 @@
//@ no-prefer-dynamic

#![crate_type = "lib"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that --crate-type dylib overrides #![crate_type = "lib"].

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's documented to behave this way: https://doc.rust-lang.org/reference/linkage.html#r-link.repetition

@bjorn3
Copy link
Member

bjorn3 commented Oct 24, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 24, 2025

📌 Commit d6956c6 has been approved by bjorn3

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 24, 2025
@bjorn3
Copy link
Member

bjorn3 commented Oct 24, 2025

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 24, 2025
static Z: u8 = (&ARRAY)[0];

pub fn main() {}
pub fn main() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the auxiliary for this test need to change? This doesn't use extern "C" {} like the other test does.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the presence of extern "C" makes a material difference. If the auxiliary for this test is not changed, the test fails just like the other one, the symbol name is just mangled:

 a.static_array_across_crate.fff1a89e6847c716-cgu.0.rcgu.o : error LNK2001: unresolved external symbol _ZN16pub_static_array5ARRAY17h4c54e0b13136769dE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants