Skip to content

Commit 7bc3222

Browse files
Rollup merge of rust-lang#39383 - nagisa:mir-uninhabited-destinations, r=pnkfelix
Remove the workaround for gh32959 This workaround is no longer necessary as Rust, and by extension MIR, now support uninhabited type properly. This removes the workaround for the gh32959 that was introduced in gh33267. Fixes rust-lang#32959
2 parents a768827 + d880bbb commit 7bc3222

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/librustc_mir/build/block.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ use rustc::hir;
1616
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
1717
pub fn ast_block(&mut self,
1818
destination: &Lvalue<'tcx>,
19-
// FIXME(#32959): temporary measure for the issue
20-
dest_is_unit: bool,
2119
mut block: BasicBlock,
2220
ast_block: &'tcx hir::Block)
2321
-> BlockAnd<()> {
@@ -83,8 +81,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
8381
// of the block.
8482
if let Some(expr) = expr {
8583
unpack!(block = this.into(destination, block, expr));
86-
} else if dest_is_unit {
87-
// FIXME(#31472)
84+
} else {
8885
let source_info = this.source_info(span);
8986
this.cfg.push_assign_unit(block, source_info, destination);
9087
}

src/librustc_mir/build/expr/into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
4040
this.in_scope(extent, block, |this| this.into(destination, block, value))
4141
}
4242
ExprKind::Block { body: ast_block } => {
43-
this.ast_block(destination, expr.ty.is_nil(), block, ast_block)
43+
this.ast_block(destination, block, ast_block)
4444
}
4545
ExprKind::Match { discriminant, arms } => {
4646
this.match_expr(destination, expr_span, block, discriminant, arms)

0 commit comments

Comments
 (0)