Rollup merge of #100132 - compiler-errors:issue-100103, r=tmiasko

Use (actually) dummy place for let-else divergence

Fixes #100103
This commit is contained in:
Matthias Krüger 2022-08-06 16:15:56 +02:00 committed by GitHub
commit eabf1a2e8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -2334,7 +2334,7 @@ pub(crate) fn ast_let_else(
// 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
};
}