Skip to content

Conversation

@samueltardieu
Copy link
Member

@samueltardieu samueltardieu commented Aug 22, 2025

assign_op_pattern can be used in a const context if the trait definition as well as the implementation of the corresponding Assign pattern is const as well.

The lint was temporarily deactivated in the compiler repository for all const contexts to avoid false positives when operators were potentially constified. This reenables it when appropriate now that the repositories have been synced.

Closes #15285

changelog: [assign_op_pattern]: trigger in const contexts when appropriate

r? @flip1995

`assign_op_pattern` can be used in a `const` context if the
trait definition as well as the implementation of the corresponding
`Assign` pattern is `const` as well.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 22, 2025
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Nice! Thanks! Ideally we'd include this in the Clippy->Rust sync. However, the Rust PR is already in the bors queue. Should it fail there, I'll include this. Otherwise, it'll have to wait until the next sync 🤷

@flip1995 flip1995 added this pull request to the merge queue Aug 22, 2025
Merged via the queue into rust-lang:master with commit b43e625 Aug 22, 2025
11 of 13 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 22, 2025
@samueltardieu samueltardieu deleted the fix-15285 branch August 22, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom handling for const-stability of assign operators in assign_op_pattern lint should be removed

3 participants