Use (actually) dummy place for let-else divergence
This commit is contained in:
parent
1b57946a40
commit
47a7a91c96
2 changed files with 16 additions and 1 deletions
|
@ -2334,7 +2334,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
// This place is not really used because this destination place
|
// This place is not really used because this destination place
|
||||||
// should never be used to take values at the end of the failure
|
// should never be used to take values at the end of the failure
|
||||||
// block.
|
// 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;
|
let failure_block;
|
||||||
unpack!(
|
unpack!(
|
||||||
failure_block = self.ast_block(
|
failure_block = self.ast_block(
|
||||||
|
|
15
src/test/ui/let-else/issue-100103.rs
Normal file
15
src/test/ui/let-else/issue-100103.rs
Normal 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
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue