never patterns: lower never patterns to Unreachable in MIR#123332
never patterns: lower never patterns to Unreachable in MIR#123332bors merged 2 commits intorust-lang:masterfrom
Unreachable in MIR#123332Conversation
|
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.
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