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:
commit
eabf1a2e8e
@ -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(
|
||||
|
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…
Reference in New Issue
Block a user