Code
I tried this code:
use std::mem::ManuallyDrop;
fn main() {
const X: ManuallyDrop<u32> = ManuallyDrop::new(1);
match ManuallyDrop::new(1) {
X => println!("blah"),
_ => println!("bleh"),
}
}
I expected to see this happen: it compiles.
Instead, this happened: it fails:
error: constant of non-structural type `MaybeDangling<u32>` in a pattern
--> src/main.rs:6:9
|
3 | const X: ManuallyDrop<u32> = ManuallyDrop::new(1);
| -------------------------- constant defined here
...
6 | X => println!("blah"),
| ^ constant of non-structural type
|
::: /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/maybe_dangling.rs:76:1
|
76 | pub struct MaybeDangling<P: ?Sized>(P);
| ----------------------------------- `MaybeDangling<u32>` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
|
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
Version it worked on
It most recently worked on: 1.93.0
Version with regression
1.94.0, introduced by #149775
Code
I tried this code:
I expected to see this happen: it compiles.
Instead, this happened: it fails:
Version it worked on
It most recently worked on: 1.93.0
Version with regression
1.94.0, introduced by #149775