summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_mir_build/src/build/expr/into.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
commit4547b622d8d29df964fa2914213088b148c498fc (patch)
tree9fc6b25f3c3add6b745be9a2400a6e96140046e9 /compiler/rustc_mir_build/src/build/expr/into.rs
parentReleasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz
rustc-4547b622d8d29df964fa2914213088b148c498fc.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_mir_build/src/build/expr/into.rs')
-rw-r--r--compiler/rustc_mir_build/src/build/expr/into.rs21
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()