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().
This commit is contained in:
Martin Nordholts 2023-10-01 08:51:47 +02:00
parent fc01a7432b
commit 41d24ccb49

View File

@ -613,7 +613,15 @@ pub fn monomorphize<T>(&self, value: T) -> T
)
}
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);
@ -841,10 +849,7 @@ fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, location: Loc
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(