Use (actually) dummy place for let-else divergence

This commit is contained in:
Michael Goulet 2022-08-04 05:08:09 +00:00
parent 1b57946a40
commit 47a7a91c96
2 changed files with 16 additions and 1 deletions

View file

@ -2334,7 +2334,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// This place is not really used because this destination place
// should never be used to take values at the end of the failure
// block.
let dummy_place = Place { local: RETURN_PLACE, projection: ty::List::empty() };
let dummy_place = self.temp(self.tcx.types.never, else_block.span);
let failure_block;
unpack!(
failure_block = self.ast_block(

View file

@ -0,0 +1,15 @@
// edition:2021
// check-pass
#![feature(try_blocks)]
#![feature(let_else)]
fn main() {
let _: Result<i32, i32> = try {
let Some(x) = Some(0) else {
Err(1)?
};
x
};
}