Skip to content

Commit 41d24cc

Browse files
committed
rustc_monomorphize: Move limit check into check_move_size()
And rename to check_operand_move_size(). Later we will introduce check_fn_args_move_size().
1 parent fc01a74 commit 41d24cc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

compiler/rustc_monomorphize/src/collector.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,15 @@ impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> {
613613
)
614614
}
615615

616-
fn check_move_size(&mut self, limit: usize, operand: &mir::Operand<'tcx>, location: Location) {
616+
fn check_operand_move_size(&mut self, operand: &mir::Operand<'tcx>, location: Location) {
617+
if self.skip_move_size_check {
618+
return;
619+
}
620+
let limit = self.tcx.move_size_limit().0;
621+
if limit == 0 {
622+
return;
623+
}
624+
617625
let limit = Size::from_bytes(limit);
618626
let ty = operand.ty(self.body, self.tcx);
619627
let ty = self.monomorphize(ty);
@@ -841,10 +849,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
841849

842850
fn visit_operand(&mut self, operand: &mir::Operand<'tcx>, location: Location) {
843851
self.super_operand(operand, location);
844-
let move_size_limit = self.tcx.move_size_limit().0;
845-
if move_size_limit > 0 && !self.skip_move_size_check {
846-
self.check_move_size(move_size_limit, operand, location);
847-
}
852+
self.check_operand_move_size(operand, location);
848853
}
849854

850855
fn visit_local(

0 commit comments

Comments
 (0)