diff options
Diffstat (limited to '')
-rw-r--r-- | compiler/rustc_mir_build/src/build/expr/into.rs | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index 24ecd0a53..218a26e62 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -108,7 +108,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ExprKind::Let { expr, ref pat } => { let scope = this.local_scope(); let (true_block, false_block) = this.in_if_then_scope(scope, expr_span, |this| { - this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span) + this.lower_let_expr(block, &this.thir[expr], pat, scope, None, expr_span, true) }); this.cfg.push_assign_constant( @@ -271,15 +271,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // MIR checks and ultimately whether code is accepted or not. We can only // omit the return edge if a return type is visibly uninhabited to a module // that makes the call. - target: if this.tcx.is_ty_uninhabited_from( - this.parent_module, - expr.ty, - this.param_env, - ) { - None - } else { - Some(success) - }, + target: expr + .ty + .is_inhabited_from(this.tcx, this.parent_module, this.param_env) + .then_some(success), from_hir_call, fn_span, }, @@ -363,10 +358,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { .map(|(n, ty)| match fields_map.get(&n) { Some(v) => v.clone(), None => { - let place_builder = place_builder.clone(); - this.consume_by_copy_or_move( - place_builder.field(n, *ty).into_place(this), - ) + let place = place_builder.clone_project(PlaceElem::Field(n, *ty)); + this.consume_by_copy_or_move(place.to_place(this)) } }) .collect() |