Skip to content

implement StructuralPartialEq for MaybeDangling#154891

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
WaffleLapkin:deregress-manually-drop-matching
Apr 7, 2026
Merged

implement StructuralPartialEq for MaybeDangling#154891
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
WaffleLapkin:deregress-manually-drop-matching

Conversation

@WaffleLapkin
Copy link
Copy Markdown
Member

@WaffleLapkin WaffleLapkin commented Apr 6, 2026

This fixes -- a stable-to-stable regression where constants of type ManuallyDrop<T> would not be allowed to be used as a pattern due to MaybeDangling<T> in ManuallyDrop<T> not implementing StructuralPartialEq.

Fixes #154890

I'm sorry, @theemathas, I forgot to address your comment 😭

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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 Apr 6, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 6, 2026

r? @JohnTitor

rustbot has assigned @JohnTitor.
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
  • compiler expanded to 69 candidates
  • Random selection from 10 candidates

Copy link
Copy Markdown
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

r=me once CI passes

View changes since this review

This fixes a stable-to-stable regression where constants of type
`ManuallyDrop<T>` would not be allowed to be used as a pattern due to
`MaybeDangling<T>` in `ManuallyDrop<T>` not implementing
`StructuralPartialEq`.
@WaffleLapkin WaffleLapkin force-pushed the deregress-manually-drop-matching branch from 68bcf7c to d5f98fb Compare April 6, 2026 16:19
@Jules-Bertholet
Copy link
Copy Markdown
Contributor

Why not just derive(PartialEq, Eq, PartialOrd, Ord, Hash) for MaybeDangling? That way, ManuallyDrop can revert to derived impls also.

@Jules-Bertholet
Copy link
Copy Markdown
Contributor

Filed a PR: #154905

@WaffleLapkin
Copy link
Copy Markdown
Member Author

@bors r=JohnTitor

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 6, 2026

📌 Commit d5f98fb has been approved by JohnTitor

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 6, 2026
…op-matching, r=JohnTitor

implement `StructuralPartialEq` for `MaybeDangling`

This fixes -- a stable-to-stable regression where constants of type `ManuallyDrop<T>` would not be allowed to be used as a pattern due to `MaybeDangling<T>` in `ManuallyDrop<T>` not implementing `StructuralPartialEq`.

Fixes rust-lang#154890

I'm sorry, @theemathas, I forgot to address your [comment](rust-lang#149614 (comment)) 😭
rust-bors bot pushed a commit that referenced this pull request Apr 7, 2026
Rollup of 6 pull requests

Successful merges:

 - #154627 (Move `rustc_middle::mir::mono` to `rustc_middle::mono`)
 - #154729 (de-non_const some `Iterator` methods)
 - #154891 (implement `StructuralPartialEq` for `MaybeDangling`)
 - #154894 (Slightly refactor mplace<->ptr conversions)
 - #154751 (compiletest: Remove `rfail` support from incremental tests)
 - #154901 (Update books)
@rust-bors rust-bors bot merged commit 7913288 into rust-lang:main Apr 7, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 7, 2026
rust-timer added a commit that referenced this pull request Apr 7, 2026
Rollup merge of #154891 - WaffleLapkin:deregress-manually-drop-matching, r=JohnTitor

implement `StructuralPartialEq` for `MaybeDangling`

This fixes -- a stable-to-stable regression where constants of type `ManuallyDrop<T>` would not be allowed to be used as a pattern due to `MaybeDangling<T>` in `ManuallyDrop<T>` not implementing `StructuralPartialEq`.

Fixes #154890

I'm sorry, @theemathas, I forgot to address your [comment](#149614 (comment)) 😭
@WaffleLapkin WaffleLapkin deleted the deregress-manually-drop-matching branch April 7, 2026 11:42
@WaffleLapkin WaffleLapkin added the relnotes Marks issues that should be documented in the release notes of the next release. label Apr 7, 2026
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Apr 8, 2026
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#154627 (Move `rustc_middle::mir::mono` to `rustc_middle::mono`)
 - rust-lang/rust#154729 (de-non_const some `Iterator` methods)
 - rust-lang/rust#154891 (implement `StructuralPartialEq` for `MaybeDangling`)
 - rust-lang/rust#154894 (Slightly refactor mplace<->ptr conversions)
 - rust-lang/rust#154751 (compiletest: Remove `rfail` support from incremental tests)
 - rust-lang/rust#154901 (Update books)
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 8, 2026
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#154627 (Move `rustc_middle::mir::mono` to `rustc_middle::mono`)
 - rust-lang/rust#154729 (de-non_const some `Iterator` methods)
 - rust-lang/rust#154891 (implement `StructuralPartialEq` for `MaybeDangling`)
 - rust-lang/rust#154894 (Slightly refactor mplace<->ptr conversions)
 - rust-lang/rust#154751 (compiletest: Remove `rfail` support from incremental tests)
 - rust-lang/rust#154901 (Update books)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

ManuallyDrop can't be used as a constant in match since 1.94

4 participants