Closed
Description
use std::pin::Pin;
enum Void {}
fn demo(x: Pin<Void>) {
match x {}
}
this compiles successfully since 1.82
The issue with this is that generally, the check does not look through private implementation details. However, the field of Pin
is technically public (only hidden and unstable) in order to support the pin!
macro.
I would have expected the above code to still fail compiling. It’s quite unlikely that anyone depends on this behavior already, because Pin
isn’t supposed to be used with non-pointers anyway.
This could be fixed by changing the inhabitedness check to treat unstable fields like private fields.
Alternatively, if kept as-is, we should add a test case for this so we at least notice the breakage if Pin
is ever re-structured to no longer using a public field.
cc @Nadrieril, I guess