-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable unreachable_pub
lint in core
#134286
Conversation
This comment has been minimized.
This comment has been minimized.
ea66587
to
1001c68
Compare
This comment has been minimized.
This comment has been minimized.
1001c68
to
9f3e1d8
Compare
This comment has been minimized.
This comment has been minimized.
9f3e1d8
to
8a52a33
Compare
This comment has been minimized.
This comment has been minimized.
8a52a33
to
3b475dd
Compare
This seems reasonable to me, does it need libs signoff? |
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 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
ef31b57
to
2fa6dbc
Compare
We discussed this in the libs meeting today, overall several people were in favor of enabling the lint and nobody objected. |
@bors r+ |
f1c6898
to
15f345b
Compare
Fixed the error and rebased. CI is green. Let's try again. @bors r=ibraheemdev |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a42d5ec): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis 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.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 764.999s -> 765.476s (0.06%) |
Enable `unreachable_pub` lint in `test` and `proc_macro` crates This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `test` and `proc_macro` crates. The diff was mostly generated with `./x.py fix --stage 1 library/proc_macro/ -- --broken-code`, as well as manual edits for code in macros and in tests. Continuation of rust-lang#134286 r? libs
Enable `unreachable_pub` lint in `test` and `proc_macro` crates This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `test` and `proc_macro` crates. The diff was mostly generated with `./x.py fix --stage 1 library/proc_macro/ -- --broken-code`, as well as manual edits for code in macros and in tests. Continuation of rust-lang#134286 r? libs
Enable `unreachable_pub` lint in `test` and `proc_macro` crates This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `test` and `proc_macro` crates. The diff was mostly generated with `./x.py fix --stage 1 library/proc_macro/ -- --broken-code`, as well as manual edits for code in macros and in tests. Continuation of rust-lang#134286 r? libs
Rollup merge of rust-lang#135366 - Urgau:unreach_pub-std-2, r=cuviper Enable `unreachable_pub` lint in `test` and `proc_macro` crates This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `test` and `proc_macro` crates. The diff was mostly generated with `./x.py fix --stage 1 library/proc_macro/ -- --broken-code`, as well as manual edits for code in macros and in tests. Continuation of rust-lang#134286 r? libs
Enable `unreachable_pub` lint in `alloc` This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `alloc` crate. Most of changes are in the btree implementation and in tests. *The diff was mostly generated with `./x.py fix --stage 1 library/alloc/ -- --broken-code`, as well as manual edits for code in macros and in tests.* Continuation of rust-lang#134286 and rust-lang#135366 r? libs
Enable `unreachable_pub` lint in `alloc` This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `alloc` crate. Most of changes are in the btree implementation and in tests. *The diff was mostly generated with `./x.py fix --stage 1 library/alloc/ -- --broken-code`, as well as manual edits for code in macros and in tests.* Continuation of rust-lang#134286 and rust-lang#135366 r? libs
Rollup merge of rust-lang#135367 - Urgau:unreach_pub-std-3, r=Noratrieb Enable `unreachable_pub` lint in `alloc` This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) lint as warn in the `alloc` crate. Most of changes are in the btree implementation and in tests. *The diff was mostly generated with `./x.py fix --stage 1 library/alloc/ -- --broken-code`, as well as manual edits for code in macros and in tests.* Continuation of rust-lang#134286 and rust-lang#135366 r? libs
…, r=Noratrieb Fix `unreachable_pub` lint for hermit target The build for the hermit target (`#[cfg(target_os = "hermit")]`) fails on master as of [8df89d1](rust-lang@8df89d1) (2025-02-05), due to introducing `#[warn(unreachable_pub)]` at the root in rust-lang#134286 (Enable unreachable_pub lint in core, merged 2025-01-20). Make the relevant visibility modifiers more specific to resolve the warning. ``` $ ./x build --target x86_64-unknown-hermit Building bootstrap Finished `dev` profile [unoptimized] target(s) in 0.34s Building stage0 library artifacts (x86_64-apple-darwin) Finished `release` profile [optimized] target(s) in 0.15s Building compiler artifacts (stage0 -> stage1, x86_64-apple-darwin) Finished `release` profile [optimized] target(s) in 1.67s Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`) Building stage1 library artifacts {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-apple-darwin -> x86_64-unknown-hermit) Compiling panic_unwind v0.0.0 (library/panic_unwind) error: unreachable `pub` item --> library/panic_unwind/src/hermit.rs:10:9 | 10 | pub fn __rust_abort() -> !; | ---^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates = note: `-D unreachable-pub` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unreachable_pub)]` error: unreachable `pub` item --> library/panic_unwind/src/hermit.rs:17:9 | 17 | pub fn __rust_abort() -> !; | ---^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates error: could not compile `panic_unwind` (lib) due to 2 previous errors Build completed unsuccessfully in 0:00:39 ```
Rollup merge of rust-lang#136595 - thaliaarchi:hermit-unreachable-pub, r=Noratrieb Fix `unreachable_pub` lint for hermit target The build for the hermit target (`#[cfg(target_os = "hermit")]`) fails on master as of [8df89d1](rust-lang@8df89d1) (2025-02-05), due to introducing `#[warn(unreachable_pub)]` at the root in rust-lang#134286 (Enable unreachable_pub lint in core, merged 2025-01-20). Make the relevant visibility modifiers more specific to resolve the warning. ``` $ ./x build --target x86_64-unknown-hermit Building bootstrap Finished `dev` profile [unoptimized] target(s) in 0.34s Building stage0 library artifacts (x86_64-apple-darwin) Finished `release` profile [optimized] target(s) in 0.15s Building compiler artifacts (stage0 -> stage1, x86_64-apple-darwin) Finished `release` profile [optimized] target(s) in 1.67s Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`) Building stage1 library artifacts {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-apple-darwin -> x86_64-unknown-hermit) Compiling panic_unwind v0.0.0 (library/panic_unwind) error: unreachable `pub` item --> library/panic_unwind/src/hermit.rs:10:9 | 10 | pub fn __rust_abort() -> !; | ---^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates = note: `-D unreachable-pub` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unreachable_pub)]` error: unreachable `pub` item --> library/panic_unwind/src/hermit.rs:17:9 | 17 | pub fn __rust_abort() -> !; | ---^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | = help: or consider exporting it for use by other crates error: could not compile `panic_unwind` (lib) due to 2 previous errors Build completed unsuccessfully in 0:00:39 ```
This PR enables the
unreachable_pub
as warn incore
,rtstartup
andpanic_unwind
.The motivation is similar to the compiler MCP: Enable deny(unreachable_pub) on
rustc_*
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