-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
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
compiler-errors and fmease
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team