Skip to content

Conversation

@ada4a
Copy link
Contributor

@ada4a ada4a commented Sep 19, 2025

Fixes #15003

changelog: [transmute_ptr_to_ptr]: add parens if transmute is receiver of a projection

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 19, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 19, 2025

r? @y21

rustbot has assigned @y21.
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

@ada4a
Copy link
Contributor Author

ada4a commented Sep 19, 2025

This really applies to all the transmute lints that suggest as, doesn't it...

@samueltardieu
Copy link
Member

samueltardieu commented Sep 20, 2025

This really applies to all the transmute lints that suggest as, doesn't it...

More than that even. I think we should have, at some point, something like:

  • a function which, given an HirId checks whether inserting something in place of this node might need to be parenthesized (even better if it returns an associativity level)
  • a function which, given a suggestion, checks whether it might need to get parentheses (even better if it returns an associativity level)
  • a function which, given an HirId and a suggestion, returns an updated suggestion with added parentheses if this is necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transmute-ptr-to-ptr'd code can no longer be assigned to

4 participants