Privately uninhabited types can affect how pattern matches are borrow-checked #137999
Labels
A-borrow-checker
Area: The borrow checker
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code compiles:
However, it only compiles because the
_v
private field is uninhabited – changing its type to()
makes it fail compilation with the following error:As discussed on Zulip, the compiler makes efforts to not make it possible to observe a type being privately uninhabited, and so this is a bug.
Meta
rustc --version --verbose
:As I discovered this bug while reading rustc sources, I am working on a PR to fix this.
@rustbot claim
The text was updated successfully, but these errors were encountered: