Skip to content

Conversation

@chenyukang
Copy link
Member

@chenyukang chenyukang commented Oct 12, 2025

Fixes #141385

r? @estebank

I added a group BuiltinCombinedLateLintPass is because module_lints is run per-module:
https://github.com/chenyukang/rust/blob/e7391b2f97ecb889cf48a1e83732bef64db0a575/compiler/rustc_lint/src/late.rs#L468-L471
but this check needs a recursive way so it's in crate_lints.

I'd like to make sure everything is OK in rustc lint before we remove it from clippy.

One thing I'm worried is this may report warning for those project without clippy checking, since now it's a builtin check and default is warn.

It's better to keep the same behavior with clippy, so how do we handle allow_private_module_inception option in clippy..

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 12, 2025
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the uplift-module-inspect branch from e7391b2 to 097f2b5 Compare October 12, 2025 10:15
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the uplift-module-inspect branch from 097f2b5 to 37d7d36 Compare October 12, 2025 11:27
@rustbot
Copy link
Collaborator

rustbot commented Oct 12, 2025

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Oct 12, 2025
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the uplift-module-inspect branch from 37d7d36 to 9260423 Compare October 16, 2025 08:31
@rust-log-analyzer

This comment has been minimized.

@chenyukang chenyukang force-pushed the uplift-module-inspect branch from 9260423 to 344bbb7 Compare October 16, 2025 09:14
@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@workingjubilee workingjubilee changed the title Uplift module inspect from clippy Uplift module inception from clippy Dec 18, 2025
@Kivooeo Kivooeo 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 Dec 18, 2025
@workingjubilee
Copy link
Member

workingjubilee commented Dec 18, 2025

I think we should allow private module inception by default, maybe just not even add it, because a common move is to do this to define your public API:

// lib.rs

pub mod module;
// module.rs

#[cfg(whatever)]
mod module {    
}

#[cfg(not(whatever))]
mod module {
}

pub use module::*;

You rarely want to think of a new name for the inner module, inner doesn't help, but you almost never want crate_name::module::module in your public API, just crate_name::module.

For configuring them: we could make them separate lints. We could also crater-run it with the private module inception on deny-by-default vs. crater-running it with allow-by-default to see the difference.

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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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.

Lint on mod foo {} inside of foo.rs

6 participants