Skip to content

Commit 1fe09b0

Browse files
committed
Ref instead of box
1 parent bf511c1 commit 1fe09b0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

compiler/rustc_middle/src/mir/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1498,14 +1498,14 @@ pub enum StatementKind<'tcx> {
14981498
}
14991499

15001500
impl<'tcx> StatementKind<'tcx> {
1501-
pub fn as_assign_mut(&mut self) -> Option<&mut Box<(Place<'tcx>, Rvalue<'tcx>)>> {
1501+
pub fn as_assign_mut(&mut self) -> Option<&mut (Place<'tcx>, Rvalue<'tcx>)> {
15021502
match self {
15031503
StatementKind::Assign(x) => Some(x),
15041504
_ => None,
15051505
}
15061506
}
15071507

1508-
pub fn as_assign(&self) -> Option<&Box<(Place<'tcx>, Rvalue<'tcx>)>> {
1508+
pub fn as_assign(&self) -> Option<&(Place<'tcx>, Rvalue<'tcx>)> {
15091509
match self {
15101510
StatementKind::Assign(x) => Some(x),
15111511
_ => None,

compiler/rustc_mir/src/transform/const_goto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ConstGotoOptimizationFinder<'a, 'tcx> {
5757
// We only apply this optimization if the last statement is a const assignment
5858
let last_statement = self.body.basic_blocks()[location.block].statements.last()?;
5959

60-
if let Some(box (place, Rvalue::Use(op))) = last_statement.kind.as_assign() {
60+
if let Some((place, Rvalue::Use(op))) = last_statement.kind.as_assign() {
6161
let _const = op.constant()?;
6262
// We found a constant being assigned to `place`.
6363
// Now check that the target of this Goto switches on this place.

compiler/rustc_mir/src/transform/simplify_comparison_integral.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyComparisonIntegral {
7676
// we convert the move in the comparison statement to a copy.
7777

7878
// unwrap is safe as we know this statement is an assign
79-
let box (_, rhs) = bb.statements[opt.bin_op_stmt_idx].kind.as_assign_mut().unwrap();
79+
let (_, rhs) = bb.statements[opt.bin_op_stmt_idx].kind.as_assign_mut().unwrap();
8080

8181
use Operand::*;
8282
match rhs {

0 commit comments

Comments
 (0)