Use (actually) dummy place for let-else divergence · rust-lang/rust@47a7a91 (original) (raw)
File tree
2 files changed
lines changed
- compiler/rustc_mir_build/src/build/matches
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2334,7 +2334,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | ||
2334 | 2334 | // This place is not really used because this destination place |
2335 | 2335 | // should never be used to take values at the end of the failure |
2336 | 2336 | // block. |
2337 | -let dummy_place = Place { local: RETURN_PLACE, projection: ty::List::empty() }; | |
2337 | +let dummy_place = self.temp(self.tcx.types.never, else_block.span); | |
2338 | 2338 | let failure_block; |
2339 | 2339 | unpack!( |
2340 | 2340 | failure_block = self.ast_block( |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
1 | +// edition:2021 | |
2 | +// check-pass | |
3 | + | |
4 | +#![feature(try_blocks)] | |
5 | +#![feature(let_else)] | |
6 | + | |
7 | +fn main() { | |
8 | +let _: Result<i32, i32> = try { | |
9 | +let Some(x) = Some(0) else { | |
10 | +Err(1)? | |
11 | +}; | |
12 | + | |
13 | + x | |
14 | +}; | |
15 | +} |