diff options
| author | Martin Nordholts <enselic@gmail.com> | 2023-10-01 08:51:47 +0200 |
|---|---|---|
| committer | Martin Nordholts <enselic@gmail.com> | 2023-10-07 10:29:16 +0200 |
| commit | 41d24ccb49102bf6e2bfb5828f6d67abd8961e00 (patch) | |
| tree | 04b35555b7590fe2086199ed2acc547f6152130f | |
| parent | fc01a7432be662270467a4c3fa4a38811b621d9d (diff) | |
| download | rust-41d24ccb49102bf6e2bfb5828f6d67abd8961e00.tar.gz rust-41d24ccb49102bf6e2bfb5828f6d67abd8961e00.zip | |
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().
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 8525a4e74c2..0ec723cb0e3 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -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); @@ -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( |
