Skip to content

Commit

Permalink
rustc_monomorphize: Move limit check into check_move_size()
Browse files Browse the repository at this point in the history
And rename to check_operand_move_size(). Later we will introduce
check_fn_args_move_size().
  • Loading branch information
Enselic committed Oct 1, 2023
1 parent a6dfd89 commit 21da1e6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions compiler/rustc_monomorphize/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,15 @@ impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> {
)
}

fn check_move_size(&mut self, limit: usize, operand: &mir::Operand<'tcx>, location: Location) {
fn check_operand_move_size(&mut self, operand: &mir::Operand<'tcx>, location: Location) {
if self.skip_move_size_check {
return;
}
let limit = self.tcx.move_size_limit().0;
if limit == 0 {
return;
}

let limit = Size::from_bytes(limit);
let ty = operand.ty(self.body, self.tcx);
let ty = self.monomorphize(ty);
Expand Down Expand Up @@ -841,10 +849,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {

fn visit_operand(&mut self, operand: &mir::Operand<'tcx>, location: Location) {
self.super_operand(operand, location);
let move_size_limit = self.tcx.move_size_limit().0;
if move_size_limit > 0 && !self.skip_move_size_check {
self.check_move_size(move_size_limit, operand, location);
}
self.check_operand_move_size(operand, location);
}

fn visit_local(
Expand Down

0 comments on commit 21da1e6

Please sign in to comment.