From e2979a8b8cf9ae6f2f2ed0d8e66a7652f1918d35 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Thu, 8 Feb 2024 09:55:34 +0100 Subject: large_assignments: Allow moves into functions Moves into functions are typically implemented with pointer passing rather than memcpy's at the llvm-ir level, so allow moves into functions. --- compiler/rustc_monomorphize/src/collector.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_monomorphize') diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 3376af98653..149e4c2cb08 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -666,7 +666,15 @@ impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> { debug!(?def_id, ?fn_span); for arg in args { - if let Some(too_large_size) = self.operand_size_if_too_large(limit, &arg.node) { + // Moving args into functions is typically implemented with pointer + // passing at the llvm-ir level and not by memcpy's. So always allow + // moving args into functions. + let operand: &mir::Operand<'tcx> = &arg.node; + if let mir::Operand::Move(_) = operand { + continue; + } + + if let Some(too_large_size) = self.operand_size_if_too_large(limit, operand) { self.lint_large_assignment(limit.0, too_large_size, location, arg.span); }; } -- cgit 1.4.1-3-g733a5