Skip to content

Added PhantomPinned diagnostic item and prevented dead field warning on PhantomPinned#157782

Open
asder8215 wants to merge 1 commit into
rust-lang:mainfrom
asder8215:phantom_pinned_dead_code
Open

Added PhantomPinned diagnostic item and prevented dead field warning on PhantomPinned#157782
asder8215 wants to merge 1 commit into
rust-lang:mainfrom
asder8215:phantom_pinned_dead_code

Conversation

@asder8215

@asder8215 asder8215 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This PR closes #154888. See #154978 and in clippy#17056 for prior history on working on this issue.

From discussing with clippy team, we thought it'd be appropriate to use a diagnostic item attribute to mark PhantomPinned and prevent dead field warnings from being emitted in missing_fields_in_debug.rs and pub_underscore_fields.rs.

If you want me to do the clippy changes separately within the clippy repository, I can do that.

@rustbot

rustbot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. 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 Jun 11, 2026
@rustbot

rustbot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, libs
  • compiler, libs expanded to 80 candidates
  • Random selection from 22 candidates

@BoxyUwU BoxyUwU left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm including the clippy bits, i assume clippy folks will want to review this though, so r=me if clippy is fine with this :3

View changes since this review

@BoxyUwU

BoxyUwU commented Jun 11, 2026

Copy link
Copy Markdown
Member

r? clippy

@rustbot rustbot assigned Alexendoo and unassigned BoxyUwU Jun 11, 2026
Comment thread src/tools/clippy/tests/ui/missing_fields_in_debug.rs Outdated
Comment thread src/tools/clippy/tests/ui/missing_fields_in_debug.rs
Comment thread src/tools/clippy/clippy_lints/src/pub_underscore_fields.rs Outdated
@rustbot rustbot 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 Jun 11, 2026
@rustbot

rustbot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@ada4a

ada4a commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Also, in my experience, when needing to add a diagnostic item for clippy, one usually makes a PR to rustc adding the diagnostic item, waits for a sync, and then does the remaining changes as a PR to clippy. Not sure how strongly this rule is followed though – I haven't been around for that long^^

@asder8215

asder8215 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Also, in my experience, when needing to add a diagnostic item for clippy, one usually makes a PR to rustc adding the diagnostic item, waits for a sync, and then does the remaining changes as a PR to clippy. Not sure how strongly this rule is followed though – I haven't been around for that long^^

Yeah, I'm aware that changes to clippy is separated from PRs made to the rust repo. But I also figured that this change was small enough and quicker to do atomically here.

@asder8215 asder8215 force-pushed the phantom_pinned_dead_code branch from 68bcbdf to 808927e Compare June 11, 2026 20:24
Comment thread src/tools/clippy/tests/ui/missing_fields_in_debug.rs Outdated
@asder8215 asder8215 force-pushed the phantom_pinned_dead_code branch from 808927e to 3abea2f Compare June 11, 2026 21:26
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-clippy Relevant to the Clippy team. 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.

PhantomPinned warns that field is never read, but PhantomData does not

5 participants