Skip to content

Conversation

@joboet
Copy link
Member

@joboet joboet commented Sep 16, 2025

This moves the dlsym-based and weak-linkage versions of the weak! macro into separate files, both of which include a common test file. As a result, both versions will be tested on all the platforms where they are used.

Since the #[link_name] arm of the dlsym version was unused, I've removed it. I've also removed the unused raw_syscall! and non-Linux syscall! macros and gated the #[allow(dead_code, unused_macros)] to only apply on non-Linux platforms, so compilation will fail if weak turns out to be unused on all platforms.

The last change concerns the use of dlsym! on FreeBSD: it is only used once, to link against sysctlbyname. But that symbol is always available, so there is no need for weak linkage.

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 16, 2025

r? @ibraheemdev

rustbot has assigned @ibraheemdev.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 16, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ibraheemdev
Copy link
Member

Looks good. r=me after the nit.

@ibraheemdev ibraheemdev 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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 14, 2025
@ibraheemdev
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 22, 2025

📌 Commit e043a0b has been approved by ibraheemdev

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 22, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 22, 2025
std: reorganize the UNIX-internal `weak` module

This moves the `dlsym`-based and weak-linkage versions of the `weak!` macro into separate files, both of which include a common test file. As a result, both versions will be tested on all the platforms where they are used.

Since the `#[link_name]` arm of the `dlsym` version was unused, I've removed it. I've also removed the unused `raw_syscall!` and non-Linux `syscall!` macros and gated the `#[allow(dead_code, unused_macros)]` to only apply on non-Linux platforms, so compilation will fail if `weak` turns out to be unused on all platforms.

The last change concerns the use of `dlsym!` on FreeBSD: it is only used once, to link against `sysctlbyname`. But that symbol is always available, so there is no need for weak linkage.
bors added a commit that referenced this pull request Oct 23, 2025
Rollup of 4 pull requests

Successful merges:

 - #115501 (Add new inherit_handles flag to CommandExt trait)
 - #146629 (std: reorganize the UNIX-internal `weak` module)
 - #147762 (feat(rustdoc): `--emit=depinfo` output to stdout via `-`)
 - #148001 (fix: Don't add diff symbol to unchanged lines)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e93ec9a into rust-lang:master Oct 23, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 23, 2025
rust-timer added a commit that referenced this pull request Oct 23, 2025
Rollup merge of #146629 - joboet:reorganize-weak, r=ibraheemdev

std: reorganize the UNIX-internal `weak` module

This moves the `dlsym`-based and weak-linkage versions of the `weak!` macro into separate files, both of which include a common test file. As a result, both versions will be tested on all the platforms where they are used.

Since the `#[link_name]` arm of the `dlsym` version was unused, I've removed it. I've also removed the unused `raw_syscall!` and non-Linux `syscall!` macros and gated the `#[allow(dead_code, unused_macros)]` to only apply on non-Linux platforms, so compilation will fail if `weak` turns out to be unused on all platforms.

The last change concerns the use of `dlsym!` on FreeBSD: it is only used once, to link against `sysctlbyname`. But that symbol is always available, so there is no need for weak linkage.
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Oct 27, 2025
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#115501 (Add new inherit_handles flag to CommandExt trait)
 - rust-lang/rust#146629 (std: reorganize the UNIX-internal `weak` module)
 - rust-lang/rust#147762 (feat(rustdoc): `--emit=depinfo` output to stdout via `-`)
 - rust-lang/rust#148001 (fix: Don't add diff symbol to unchanged lines)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants