Skip to content

std: make a lot of items crate private - #161612

Open
pacak wants to merge 1 commit into
rust-lang:mainfrom
pacak:unreachable-pub
Open

std: make a lot of items crate private#161612
pacak wants to merge 1 commit into
rust-lang:mainfrom
pacak:unreachable-pub

Conversation

@pacak

@pacak pacak commented Aug 23, 2026

Copy link
Copy Markdown
Contributor
  1. Enabled warn(unreachable_pub)
  2. Made a lot of things crate private, to the point when doing more required adding exceptions
  3. Removed warn(unreachable_pub)

So now this commit just tightens the current visibility without trying to enforce it.

View all comments

r? clarfonthey

@rustbot rustbot added the O-unix Operating system: Unix-like label Aug 23, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 23, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@pacak
pacak force-pushed the unreachable-pub branch 2 times, most recently from af7af07 to a6a436d Compare August 23, 2026 18:59
@rustbot rustbot added the O-windows Operating system: Windows label Aug 23, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@clarfonthey

Copy link
Copy Markdown
Contributor

So, looking at this, I'm going to nominate this for discussion alongside the clippy lints PR: #161328

Since they should go together, I think.

@rustbot label:I-libs-nominated

@rustbot rustbot added the I-libs-nominated Nominated for discussion during a libs team meeting. label Aug 23, 2026
@pacak

pacak commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

Sure.

Please no more obscure platform failures, please no more obscure platform failures, please no more obscure platform failures, please no more obscure platform failures...

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) label Aug 23, 2026
Comment thread library/std/src/sys/pal/windows/c/windows_sys.rs
@pacak
pacak force-pushed the unreachable-pub branch 2 times, most recently from 69a1881 to 21fd14f Compare August 23, 2026 21:41
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@pacak

pacak commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@clarfonthey thoughts? I don't mind keep rebasing it if you need more time to review/decide, but I'm also okay with just closing it - it doesn't really affect me at least at the moment.

@clarfonthey

Copy link
Copy Markdown
Contributor

Sorry, been scatterbrained preparing for rustconf and being at rustconf. Wanted to say essentially, I'm fine unilaterally merging this for non-os/sys modules but would probably want to hold off on those for now.

@pacak

pacak commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

I forgor about the rustconf :)
Ping me when you are ready then.

@clarfonthey

Copy link
Copy Markdown
Contributor

Is all good! I forgor mentioning it. But yeah, I would be fine doing r+ for non os/sys module stuff but would probably hold off on other modules for now.

Most of them don't need to be public, but there are scenarios where
thing is private on one platform but public on the other, so having a
lint on all the time gets complicated.

I enabled the lint, made a lot of things private to the point that
dealing with the rest required adding exceptions and disabled the lint
back again.
@rustbot

rustbot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@pacak

pacak commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Tests are passing. I explicitly allow unreachable_pub in os and sys and removed all the changes to them from this pull request.

@clarfonthey

Copy link
Copy Markdown
Contributor

Thank you! And apologies for taking a while on this one.

@bors r+ rollup

@rust-bors

rust-bors Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 081b1b5 has been approved by clarfonthey

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Sep 13, 2026
@pacak

pacak commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

No worries.

For the rest - I've been thinking about adding #[warn(unreachable-pub)] inside of os specific modules. Say something is for Linux and comes with #[cfg(target_os = "linux")] or whatever the right syntax is. As far as insides of this module are concerned - there's no other OSes. Does this make sense? Shared stuff stays allowed.

@clarfonthey

Copy link
Copy Markdown
Contributor

So, actually, I kind of want to do the opposite: specifically enabling this lint on target-independent code, since it runs everywhere, but not on target-specific code, which will only selectively lint when it's enabled. But ultimately, the main reason why I didn't want to deal with os/sys for now is that we have other initiatives to refactor those modules and I don't want to do anything major without a larger discussion.

jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 13, 2026
std: make a lot of items crate private

1. Enabled `warn(unreachable_pub)`
2. Made a lot of things crate private, to the point when doing more required adding exceptions
3. Removed `warn(unreachable_pub)`

So now this commit just tightens the current visibility without trying to enforce it.

r? clarfonthey
rust-bors Bot pushed a commit that referenced this pull request Sep 13, 2026
Rollup of 5 pull requests

Successful merges:

 - #162732 (Fix unsound dealloc of reborrows from custom allocators)
 - #154113 (std::net: clamp multicast ttl value to u8 max.)
 - #161178 (lint ineffective #[unstable] annotations on re-exports)
 - #161612 (std: make a lot of items crate private)
 - #162717 (prevent ICE from `derive` on `repr(packed)` enum)
@jhpratt

jhpratt commented Sep 14, 2026

Copy link
Copy Markdown
Member

Looks like there are two things: one case was missed and the lint was left enabled in some spot (despite the PR description).

#162737 (comment)

@bors r-

@rust-bors rust-bors Bot 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 Sep 14, 2026
@rust-bors

rust-bors Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#162737), which was unapproved.

View changes since this unapproval

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

Labels

O-apple Operating system: Apple / Darwin (macOS, iOS, tvOS, visionOS, watchOS) O-unix Operating system: Unix-like O-windows Operating system: Windows S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

7 participants