Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use (actually) dummy place for let-else divergence #100132

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
};
}