internal: remove dead #[allow] attributes - #22906
Conversation
|
Please note that our AI policy disallows using AI to write GitHub comments, including PR descriptions. |
| @@ -111,9 +111,7 @@ use crate::{ | |||
| // This lint has a false positive here. See the link below for details. | |||
There was a problem hiding this comment.
Please remove this comment as well.
| }; | ||
| let arg_id = MacroCallId::new(db, loc); | ||
| #[allow(deprecated)] // builtin eager macros are never derives | ||
| let (_, _, span) = arg_id.macro_arg(db); |
There was a problem hiding this comment.
This is incorrect, the #[deprecated] was just lost during the Salsa transition, we should add it back.
| /// This is not connected to the database so it does not cache the result. However, the inner [macro_arg] query is | ||
| /// | ||
| /// [macro_arg]: Self::macro_arg | ||
| #[allow(deprecated)] // we are macro_arg_considering_derives |
|
infer.rs - I removed the comment eager.rs + lib.rs - you’re right they aren’t dead but your fix doesn’t compile. #[salsa::tracked] expand the method into a trait impl. I tried both attribute orders and got the same error. So the depreciation wasn’t dropped by oversight in the salsa transition, it stopped being expressable. rustc rejects it: There is a workaround: rename the tracked query to macro_arg_ and put #[deprecated] on a thin wrapper. The same _-suffix pattern already in cli/flags.rs. I confirmed it compiles and that the warning genuinely fires (stripped the allow back out and the deprecation warning appeared). But it renames a salsa query so do you want that or leave those two allows deleted? Allow-expect - for the whole codebase or just the touched files? 134 of 153 allow sites sit inside macro expansions where expect breaks because other expansions of the same macro still need the suppression. |
There was a problem hiding this comment.
eager.rs + lib.rs - you’re right they aren’t dead but your fix doesn’t compile. #[salsa::tracked] expand the method into a trait impl. I tried both attribute orders and got the same error. So the depreciation wasn’t dropped by oversight in the salsa transition, it stopped being expressable.
Ugh. Okay then I guess a comment above the function to not remove it will be enough, you don't need to insert an inner function.
Allow-expect - for the whole codebase or just the touched files? 134 of 153 allow sites sit inside macro expansions where expect breaks because other expansions of the same macro still need the suppression.
For the whole codebases, but only outside of macros. You can do that in a separate PR if you want.
Please also squash.
The suppressions at the `macro_arg` call sites are kept: the `#[deprecated]` they suppress was lost in the Salsa transition and is no longer expressible, since `#[salsa::tracked]` expands the method into a trait impl and rustc rejects `#[deprecated]` on trait methods in impl blocks. A comment on the query records that intent instead. Assisted-by: Claude (see AI_POLICY.md)
456a5a2 to
6c66805
Compare
Each of these 20
#[allow(..)]attributes suppresses a lint that no longerfires at that site, so the attribute currently has no effect. The change is
purely subtractive — 20 deletions, no statement, signature or behaviour change.
How they were found
#[allow(..)]undercrates/to#[expect(..)]and collectedunfulfilled_lint_expectations.not dead: the suppression is still needed by other expansions of the same
macro. This was the large majority (134 of 153 sites).
rebuilding.
Step 3 was not redundant. One candidate that step 1 reported as unfulfilled —
#[allow(unused_mut)]incrates/hir-def/src/expr_store/lower/path.rs— makesunused_mutfire when removed, because that binding is only mutated under#[cfg(test)]. It is left untouched here. An unfulfilled expectation is not byitself proof that an
allowis dead.Verification
cargo check --workspace --all-targets— clean, no diagnostics.RUSTFLAGS="-W unreachable-pub --cfg no_salsa_async_drops".Cargo.lockis deliberately untouched. (It does churn locally on a pristinecheckout too —
salsa-macros— so that is unrelated to this change.)Not covered
I could not build the
in-rust-treefeature (needs a nightly toolchain), sothese were not checked under it. As far as I can tell CI only builds that
feature for
proc-macro-srv,proc-macro-srv-cliandproc-macro-api, none ofwhich are touched here — but flagging it rather than implying coverage I don't
have.
Happy to split this per-crate if that is easier to review.