Skip to content

Continue refactoring MIR drop generation #64225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
2 changes: 0 additions & 2 deletions src/librustc_mir/build/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
expr_span,
scope,
result,
expr.ty,
);
}

Expand Down Expand Up @@ -569,7 +568,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
upvar_span,
temp_lifetime,
temp,
upvar_ty,
);
}

Expand Down
2 changes: 0 additions & 2 deletions src/librustc_mir/build/expr/as_temp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
expr_span,
temp_lifetime,
temp,
expr_ty,
DropKind::Storage,
);
}
Expand All @@ -117,7 +116,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
expr_span,
temp_lifetime,
temp,
expr_ty,
DropKind::Value,
);
}
Expand Down
7 changes: 2 additions & 5 deletions src/librustc_mir/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
};

// Step 5. Create everything else: the guards and the arms.
let match_scope = self.scopes.topmost();
let match_scope = self.topmost_scope();

let arm_end_blocks: Vec<_> = arm_candidates.into_iter().map(|(arm, mut candidates)| {
let arm_source_info = self.source_info(arm.span);
Expand Down Expand Up @@ -535,21 +535,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
kind: StatementKind::StorageLive(local_id),
},
);
let var_ty = self.local_decls[local_id].ty;
let region_scope = self.hir.region_scope_tree.var_scope(var.local_id);
self.schedule_drop(span, region_scope, local_id, var_ty, DropKind::Storage);
self.schedule_drop(span, region_scope, local_id, DropKind::Storage);
Place::from(local_id)
}

pub fn schedule_drop_for_binding(&mut self, var: HirId, span: Span, for_guard: ForGuard) {
let local_id = self.var_local_id(var, for_guard);
let var_ty = self.local_decls[local_id].ty;
let region_scope = self.hir.region_scope_tree.var_scope(var.local_id);
self.schedule_drop(
span,
region_scope,
local_id,
var_ty,
DropKind::Value,
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,12 +812,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Function arguments always get the first Local indices after the return place
let local = Local::new(index + 1);
let place = Place::from(local);
let &ArgInfo(ty, opt_ty_info, arg_opt, ref self_binding) = arg_info;
let &ArgInfo(_, opt_ty_info, arg_opt, ref self_binding) = arg_info;

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

if let Some(arg) = arg_opt {
Expand Down
Loading