Skip to content
Open
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
6 changes: 3 additions & 3 deletions compiler/rustc_mir_build/src/builder/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {

// Declare the bindings, which may create a source scope.
let remainder_span = remainder_scope.span(this.tcx, this.region_scope_tree);
this.push_scope((*remainder_scope, source_info));
this.push_scope(*remainder_scope);
let_scope_stack.push(remainder_scope);

let visibility_scope =
Expand Down Expand Up @@ -242,7 +242,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
this.block_context.push(BlockFrame::Statement { ignores_expr_result });

// Enter the remainder scope, i.e., the bindings' destruction scope.
this.push_scope((*remainder_scope, source_info));
this.push_scope(*remainder_scope);
let_scope_stack.push(remainder_scope);

// Declare the bindings, which may create a source scope.
Expand Down Expand Up @@ -346,7 +346,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Finally, we pop all the let scopes before exiting out from the scope of block
// itself.
for scope in let_scope_stack.into_iter().rev() {
block = this.pop_scope((*scope, source_info), block).into_block();
block = this.pop_scope(*scope, block).into_block();
}
// Restore the original source scope.
this.source_scope = outer_source_scope;
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_mir_build/src/builder/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// This can be `None` if the expression's temporary scope was extended so that it can be
// borrowed by a `const` or `static`. In that case, it's never dropped.
if let Some(temp_lifetime) = temp_lifetime {
this.schedule_drop_storage_and_value(upvar_span, temp_lifetime, temp);
this.schedule_drop_storage(upvar_span, temp_lifetime, temp);
this.schedule_drop_value(upvar_span, temp_lifetime, temp);
}

block.and(Operand::Move(Place::from(temp)))
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_mir_build/src/builder/expr/as_temp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_middle::mir::*;
use rustc_middle::thir::*;
use tracing::{debug, instrument};

use crate::builder::scope::{DropKind, LintLevel};
use crate::builder::scope::LintLevel;
use crate::builder::{BlockAnd, BlockAndExtension, Builder};

impl<'a, 'tcx> Builder<'a, 'tcx> {
Expand Down Expand Up @@ -120,15 +120,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// `bar(&foo())` or anything within a block will keep the
// regular drops just like runtime code.
if let Some(temp_lifetime) = temp_lifetime.temp_lifetime {
this.schedule_drop(expr_span, temp_lifetime, temp, DropKind::Storage);
this.schedule_drop_storage(expr_span, temp_lifetime, temp);
}
}
}

block = this.expr_into_dest(temp_place, block, expr_id).into_block();

if let Some(temp_lifetime) = temp_lifetime.temp_lifetime {
this.schedule_drop(expr_span, temp_lifetime, temp, DropKind::Value);
this.schedule_drop_value(expr_span, temp_lifetime, temp);
}

if let Some(backwards_incompatible) = temp_lifetime.backwards_incompatible {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_mir_build/src/builder/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::builder::ForGuard::{self, OutsideGuard, RefWithinGuard};
use crate::builder::expr::as_place::PlaceBuilder;
use crate::builder::matches::buckets::PartitionedCandidates;
use crate::builder::matches::user_ty::ProjectedUserTypesNode;
use crate::builder::scope::{DropKind, LintLevel};
use crate::builder::scope::LintLevel;
use crate::builder::{
BlockAnd, BlockAndExtension, Builder, GuardFrame, GuardFrameLocal, LocalsForNode,
};
Expand Down Expand Up @@ -791,7 +791,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
if let Some(region_scope) = self.region_scope_tree.var_scope(var.0.local_id)
&& matches!(schedule_drop, ScheduleDrops::Yes)
{
self.schedule_drop(span, region_scope, local_id, DropKind::Storage);
self.schedule_drop_storage(span, region_scope, local_id);
}
let local_info = self.local_decls[local_id].local_info.as_mut().unwrap_crate_local();
if let LocalInfo::User(BindingForm::Var(var_info)) = &mut **local_info {
Expand All @@ -808,7 +808,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
) {
let local_id = self.var_local_id(var, for_guard);
if let Some(region_scope) = self.region_scope_tree.var_scope(var.0.local_id) {
self.schedule_drop(span, region_scope, local_id, DropKind::Value);
self.schedule_drop_value(span, region_scope, local_id);
}
}

Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_mir_build/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use rustc_middle::{bug, span_bug};
use rustc_span::{Span, Symbol};

use crate::builder::expr::as_place::PlaceBuilder;
use crate::builder::scope::{DropKind, LintLevel};
use crate::builder::scope::LintLevel;

pub(crate) fn closure_saved_names_of_captured_variables<'tcx>(
tcx: TyCtxt<'tcx>,
Expand Down Expand Up @@ -955,11 +955,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let place = Place::from(local);

// Make sure we drop (parts of) the argument even when not matched on.
self.schedule_drop(
self.schedule_drop_value(
param.pat.as_ref().map_or(expr_span, |pat| pat.span),
argument_scope,
local,
DropKind::Value,
);

let Some(ref pat) = param.pat else {
Expand Down
Loading
Loading