Skip to content

Enable unreachable_pub lint in core - #134286

Merged
bors merged 4 commits into
rust-lang:masterfrom
Urgau:unreach_pub-std
Jan 21, 2025
Merged

bors merged 4 commits into
rust-lang:masterfrom
Urgau:unreach_pub-std

Conversation

@Urgau

@Urgau Urgau commented Dec 13, 2024

Copy link
Copy Markdown
Member

This PR enables the unreachable_pub as warn in core, rtstartup and panic_unwind.

The motivation is similar to the compiler MCP: Enable deny(unreachable_pub) on rustc_* crates :

"Where is this thing used?" is a question I ask all the time when reading unfamiliar code. Because of this, I generally find it annoying when things are marked with a more permissive visibility than necessary. "This thing marked pub, which other crates is it used in? Oh, it's not used in any other crates."

Another motivation is to help to lint by utilizing it in-tree and seeing it's limitation in more complex scenarios.

The diff was mostly generated with ./x.py fix --stage 1 library/core/ -- --broken-code, as well as manual edits for code in macros, generated code and other targets.

r? libs

@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 Dec 13, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ibraheemdev

Copy link
Copy Markdown
Member

This seems reasonable to me, does it need libs signoff?

@Urgau

Urgau commented Dec 27, 2024

Copy link
Copy Markdown
Member Author

I don't know T-libs customs around enabling new lints. Given that T-compiler as done an MCP I guess it doesn't hurt to at least nominate it.

@rustbot labels -S-waiting-on-review +S-waiting-on-team +I-libs-nominated

@rustbot rustbot added I-libs-nominated Nominated for discussion during a libs team meeting. S-waiting-on-team and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 27, 2024
@bors

This comment was marked as resolved.

@bors

This comment was marked as resolved.

Comment thread library/core/src/lib.rs
@Amanieu

ghost commented Jan 15, 2025

Copy link
Copy Markdown
Member

We discussed this in the libs meeting today, overall several people were in favor of enabling the lint and nobody objected.

@Amanieu Amanieu added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed I-libs-nominated Nominated for discussion during a libs team meeting. S-waiting-on-team labels Jan 15, 2025
@ibraheemdev

ghost commented Jan 16, 2025

Copy link
Copy Markdown
Member

@bors r+

@bors

ghost commented Jan 16, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 2fa6dbc has been approved by ibraheemdev

It is now in the queue for this repository.

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 21, 2025
@bors
bors merged commit a42d5ec into rust-lang:master Jan 21, 2025
@rustbot rustbot added this to the 1.86.0 milestone Jan 21, 2025
@rust-timer

ghost commented Jan 21, 2025

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (a42d5ec): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (secondary -2.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 764.999s -> 765.476s (0.06%)
Artifact size: 326.01 MiB -> 326.00 MiB (-0.00%)

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

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

9 participants