-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE: called Option::unwrap()
on a None
value with refutable patterns
#138973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The ICE only occurs on edition 2021 or 2024. It has been ICE-ing since rust 1.56.0 (the first version where edition 2021 was stable). |
I think what's happening here is that upvar analysis sees an irrefutable non-binding pattern, and decides to not capture |
It's unclear to me whether this sort of pattern should capture or not. Not-capturing is more “precise”, but requires MIR building to know that it should skip the test against (I'm not familiar with the design history of precise capture, so I don't know how many of these edge-case details are deliberately decided, versus unintentionally falling out of implementation details.) |
This was found while investigating #138958, but unlike that issue, this code is already an ICE on stable and not a recent regression.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: