-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
rustc_lint: Some early linting refactorings #91526
Conversation
Some changes occurred in src/tools/clippy. cc @rust-lang/clippy |
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
The removal of the fake |
Updated. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
007e6d6
to
175130d
Compare
This comment has been minimized.
This comment has been minimized.
175130d
to
c8803cf
Compare
Ping @estebank, it's been 3 weeks. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ping @estebank, it's been 6 weeks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pre-expansion lint infra is only used for the KeywordIdents
lint. I'm wondering if such infra is really worth the complexity, or if we should just hardcode this lint and drop pre-expansion lints.
Either way, r=me after a rebase.
@@ -118,6 +118,8 @@ mod sty; | |||
|
|||
// Data types | |||
|
|||
pub type RegisteredTools = FxHashSet<Ident>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-existing: do we use the span or the hygiene in the Ident
, or can it simply be a FxHashSet<Symbol>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used during name resolution, but in ResolverOutputs
it could already be FxHashSet<Symbol>
, I just didn't bother converting and used the same type everywhere.
I'm also not sure how useful all of this is, but there are also a couple of lints in clippy using the same pre-expansion lint infra. |
Use consistent function parameter order for early context construction and early linting Rename some functions to make it clear that they do not necessarily work on the whole crate
Add a trait generalizing over the crate root and freshly loaded modules instead This also makes node IDs used for pre-expansion linting more precise
📌 Commit 67cccaf has been approved by |
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#91526 (rustc_lint: Some early linting refactorings) - rust-lang#92555 (Implement RFC 3151: Scoped threads.) - rust-lang#93213 (Fix `let_chains` and `if_let_guard` feature flags) - rust-lang#93219 (Add preliminary support for inline assembly for msp430.) - rust-lang#93226 (Normalize field access types during borrowck) - rust-lang#93227 (Liberate late bound regions when collecting GAT substs in wfcheck) - rust-lang#93229 (Remove DiagnosticBuilder.quiet) - rust-lang#93234 (rustc_mir_itertools: Avoid needless `collect` with itertools) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The first one removes and renames some fields and methods from
EarlyContext
.The second one uses the set of registered tools (for tool attributes and tool lints) in a more centralized way.
The third one removes creation of a fake
ast::Crate
fromfn pre_expansion_lint
.Pre-expansion linting is done with per-module granularity on freshly loaded modules, and it previously synthesized an
ast::Crate
to visit non-root modules, now they are visited as modules.The node ID used for pre-expansion linting is also made more precise (the loaded module ID is used).