diff options
| author | Martin Nordholts <martin.nordholts@codetale.se> | 2024-02-08 09:55:34 +0100 |
|---|---|---|
| committer | Martin Nordholts <martin.nordholts@codetale.se> | 2024-02-10 16:17:00 +0100 |
| commit | e2979a8b8cf9ae6f2f2ed0d8e66a7652f1918d35 (patch) | |
| tree | 7381e8e0e5b47886633e730a2b9ea34d8cb2df02 /compiler/rustc_monomorphize | |
| parent | 1a0200ebc0802fc33ee8aad6f1e94ad71be19aa0 (diff) | |
| download | rust-e2979a8b8cf9ae6f2f2ed0d8e66a7652f1918d35.tar.gz rust-e2979a8b8cf9ae6f2f2ed0d8e66a7652f1918d35.zip | |
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.
Diffstat (limited to 'compiler/rustc_monomorphize')
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 10 |
1 files changed, 9 insertions, 1 deletions
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); }; } |
