impl<'a,'tcx> Builder<'a,'tcx> {
pub fn ast_block(&mut self,
destination: &Lvalue<'tcx>,
+ // FIXME(#32959): temporary measure for the issue
+ dest_is_unit: bool,
mut block: BasicBlock,
ast_block: &'tcx hir::Block)
-> BlockAnd<()> {
// of the block.
if let Some(expr) = expr {
unpack!(block = this.into(destination, block, expr));
- } else {
+ } else if dest_is_unit {
// FIXME(#31472)
let scope_id = this.innermost_scope_id();
this.cfg.push_assign_unit(block, scope_id, span, destination);
this.in_scope(extent, block, |this, _| this.into(destination, block, value))
}
ExprKind::Block { body: ast_block } => {
- this.ast_block(destination, block, ast_block)
+ this.ast_block(destination, expr.ty.is_nil(), block, ast_block)
}
ExprKind::Match { discriminant, arms } => {
this.match_expr(destination, expr_span, block, discriminant, arms)
CodeExtentData::ParameterScope { fn_id: fn_id, body_id: body_id });
unpack!(block = builder.in_scope(arg_extent, block, |builder, arg_scope_id| {
arg_decls = Some(unpack!(block = builder.args_and_body(block,
+ return_ty,
implicit_arguments,
explicit_arguments,
arg_scope_id,
impl<'a,'tcx> Builder<'a,'tcx> {
fn args_and_body(&mut self,
mut block: BasicBlock,
+ return_ty: FnOutput<'tcx>,
implicit_arguments: Vec<Ty<'tcx>>,
explicit_arguments: Vec<(Ty<'tcx>, &'tcx hir::Pat)>,
argument_scope_id: ScopeId,
})
.collect();
+ // FIXME(#32959): temporary hack for the issue at hand
+ let return_is_unit = if let FnOutput::FnConverging(t) = return_ty {
+ t.is_nil()
+ } else {
+ false
+ };
// start the first basic block and translate the body
- unpack!(block = self.ast_block(&Lvalue::ReturnPointer, block, ast_block));
+ unpack!(block = self.ast_block(&Lvalue::ReturnPointer, return_is_unit, block, ast_block));
block.and(arg_decls)
}