Skip to content

Commit

Permalink
Use (actually) dummy place for let-else divergence
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Aug 4, 2022
1 parent 1b57946 commit 47a7a91
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
15 changes: 15 additions & 0 deletions src/test/ui/let-else/issue-100103.rs
Original file line number Diff line number Diff line change
@@ -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
};
}

0 comments on commit 47a7a91

Please sign in to comment.