Repository navigation
Lint #[deprecated] on use items, where it has no effect - #165842
Open
johncarmack1984 wants to merge 1 commit into
Open
johncarmack1984 wants to merge 1 commit into
johncarmack1984 wants to merge 1 commit into
Conversation
Collaborator
|
|
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project has assigned @WaffleLapkin (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. |
This comment has been minimized.
This comment has been minimized.
Deprecation is checked on the item a path resolves to, so a `#[deprecated]` attribute on a `use` item is accepted and never consulted at use sites. Deprecating a re-export that way warns nobody. Add `ineffective_deprecated_reexports`, a warn-by-default lint emitted from the stability checker for every `use` item carrying `#[deprecated]`. Its note says this is a long-standing bug and links the tracking issue; its help suggests deprecating the item itself, or a `#[deprecated]` type alias or wrapper function where one applies. core (`alloc::LayoutErr`) and std (`collections::Bound`) each carry one of these attributes. Both get an item-level `#[expect]`, which std's deny-warnings build turns into an error once the lint stops firing there, so the annotations go away with the fix for deprecating re-exports. The run-rustfix import test carries its expectation on the item too: a crate-level one is unfulfilled in the fixed output, which removes the annotated `use`.
johncarmack1984
force-pushed
the
deprecated-reexport-lint
branch
from
November 12, 2026 04:07
ee5fc9e to
0c50040
Compare
Contributor
|
What exactly is the LLM involvement here? What does "I wrote this lint" entail? |
Member
Hi, first of all, all user-facing components including PR description should be written manually from start to finish; otherwise, this violates our policy. Second, you should have found a pre-arranged LLM reviewer in #llm-reviews before opening a PR. More you can read in our LLM policy. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#[deprecated]on auseitem is accepted and then ignored: deprecation is checked on the resolved item, not on the imports a path went through, so deprecating a re-export that way warns nobody (#30827). This addsineffective_deprecated_reexports, a warn-by-default lint that says so at the attribute, notes that it's a long-standing bug, and suggests what does work: deprecating the item itself, or a#[deprecated]type alias or wrapper function where one applies.Choices:
useless_deprecated, which is deny-by-default. The review on Add lint rule for#[deprecated]on re-exports (rebase) #142731 asked for a lint instead of an error.rustc_passes, next toineffective_unstable_reexports(lint ineffective #[unstable] annotations on re-exports #161178).use Alias::Variant, a function needs a wrapper, and a module or macro re-export has no equivalent.alloc::LayoutErr) and std (collections::Bound) each carry one of these attributes. Both get an item-level#[expect], which std's deny-warnings build turns into an error once the lint stops firing there; core gets a FIXME, std already had one. The run-rustfix test intests/ui/importscarries its expectation on the item: a crate-level one is unfulfilled in the fixed output, which deletes the annotateduse.The fix for #30827 should delete this lint.
Supersedes #142731 (I asked GrigorenkoPV there on Oct 22 whether they planned to return to it and haven't heard back). Closes #142436.
r? @WaffleLapkin
LLM disclosure: I wrote this lint. Claude Code (Fable 5.1, then Opus 5.5, both max effort) evaluated the design options in the issue's history, drafted the implementation, docs and tests, and ran the test suites. Codex reviewed. I pared and reviewed every line.