-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
never patterns: lower never patterns to Unreachable
in MIR
#123332
Conversation
hmmmm maybe r? @matthewjasper instead? happy to review it if matthewjasper is unavailable tho |
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
//@ known-bug: #120421 | ||
//@ compile-flags: -Zlint-mir | ||
|
||
#![feature(never_patterns)] | ||
|
||
enum Void {} | ||
|
||
fn main() { | ||
let res_void: Result<bool, Void> = Ok(true); | ||
|
||
for (Ok(mut _x) | Err(!)) in [res_void] {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted this because it felt like an entirely artificial construct and I couldn't find a sensible name to keep it under. What surprises me is that it took something so complicated to break the feature back when it was explicitly not lowering to MIR correctly. It's probably not minimal
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (0f40f14): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 676.002s -> 676.385s (0.06%) |
This lowers a
!
pattern to "goto Unreachable". Ideally I'd like to read from the place to make it clear that the UB is coming from an invalid value, but that's tricky so I'm leaving it for later.r? @compiler-errors how do you feel about a lil bit of MIR lowering