Skip to content

Commit 8d2116e

Browse files
committed
use deref_patterns in rustc_mir_dataflow
1 parent 441ef9e commit 8d2116e

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

compiler/rustc_mir_dataflow/src/impls/initialized.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl<'tcx> MaybePlacesSwitchIntData<'tcx> {
5454
let block_data = &body[block];
5555
for statement in block_data.statements.iter().rev() {
5656
match statement.kind {
57-
mir::StatementKind::Assign(box (lhs, mir::Rvalue::Discriminant(enum_place)))
57+
mir::StatementKind::Assign((lhs, mir::Rvalue::Discriminant(enum_place)))
5858
if lhs == discr =>
5959
{
6060
match enum_place.ty(body, tcx).ty.kind() {

compiler/rustc_mir_dataflow/src/impls/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<'a> MaybeTransitiveLiveLocals<'a> {
231231
) -> Option<Place<'tcx>> {
232232
// Compute the place that we are storing to, if any
233233
let destination = match stmt_kind {
234-
StatementKind::Assign(box (place, rvalue)) => (rvalue.is_safe_to_remove()
234+
StatementKind::Assign((place, rvalue)) => (rvalue.is_safe_to_remove()
235235
// FIXME: We are not sure how we should represent this debugging information for some statements,
236236
// keep it for now.
237237
&& (!debuginfo_locals.contains(place.local)

compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ impl<'tcx> Analysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
156156
StatementKind::StorageDead(l) => state.kill(*l),
157157

158158
// If a place is assigned to in a statement, it needs storage for that statement.
159-
StatementKind::Assign(box (place, _))
160-
| StatementKind::SetDiscriminant { box place, .. } => {
159+
StatementKind::Assign((place, _)) => {
160+
state.gen_(place.local);
161+
}
162+
StatementKind::SetDiscriminant { place, .. } => {
161163
state.gen_(place.local);
162164
}
163165

compiler/rustc_mir_dataflow/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// tidy-alphabetical-start
22
#![feature(associated_type_defaults)]
3-
#![feature(box_patterns)]
3+
#![feature(deref_patterns)]
44
#![feature(exact_size_is_empty)]
55
#![feature(file_buffered)]
66
#![feature(never_type)]

compiler/rustc_mir_dataflow/src/move_paths/builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl<'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> MoveDataBuilder<'a, 'tcx, F> {
379379
fn gather_statement(&mut self, stmt: &Statement<'tcx>) {
380380
debug!("gather_statement({:?}, {:?})", self.loc, stmt);
381381
match &stmt.kind {
382-
StatementKind::Assign(box (place, Rvalue::CopyForDeref(reffed))) => {
382+
StatementKind::Assign((place, Rvalue::CopyForDeref(reffed))) => {
383383
let local = place.as_local().unwrap();
384384
assert!(self.body.local_decls[local].is_deref_temp());
385385

@@ -389,12 +389,12 @@ impl<'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> MoveDataBuilder<'a, 'tcx, F> {
389389
let base_local = rev_lookup.un_derefer.deref_chain(local).first().unwrap().local;
390390
rev_lookup.locals[local] = rev_lookup.locals[base_local];
391391
}
392-
StatementKind::Assign(box (place, rval)) => {
392+
StatementKind::Assign((place, rval)) => {
393393
self.create_move_path(*place);
394394
self.gather_init(place.as_ref(), InitKind::Deep);
395395
self.gather_rvalue(rval);
396396
}
397-
StatementKind::FakeRead(box (_, place)) => {
397+
StatementKind::FakeRead((_, place)) => {
398398
self.create_move_path(*place);
399399
}
400400
StatementKind::StorageLive(_) => {}
@@ -428,7 +428,7 @@ impl<'a, 'tcx, F: Fn(Ty<'tcx>) -> bool> MoveDataBuilder<'a, 'tcx, F> {
428428
| Rvalue::Cast(_, ref operand, _)
429429
| Rvalue::UnaryOp(_, ref operand)
430430
| Rvalue::WrapUnsafeBinder(ref operand, _) => self.gather_operand(operand),
431-
Rvalue::BinaryOp(ref _binop, box (ref lhs, ref rhs)) => {
431+
Rvalue::BinaryOp(ref _binop, (ref lhs, ref rhs)) => {
432432
self.gather_operand(lhs);
433433
self.gather_operand(rhs);
434434
}

compiler/rustc_mir_dataflow/src/rustc_peek.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn value_assigned_to_local<'a, 'tcx>(
119119
stmt: &'a mir::Statement<'tcx>,
120120
local: Local,
121121
) -> Option<&'a mir::Rvalue<'tcx>> {
122-
if let mir::StatementKind::Assign(box (place, rvalue)) = &stmt.kind
122+
if let mir::StatementKind::Assign((place, rvalue)) = &stmt.kind
123123
&& let Some(l) = place.as_local()
124124
&& local == l
125125
{

0 commit comments

Comments
 (0)