diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-11 01:37:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-11 01:37:55 +0100 |
| commit | fd287d2e88fc7c5a85e544fb2c37223575a53cae (patch) | |
| tree | b9785009fdc3ffe7a45e168b52c1bb75b911f27d /compiler/rustc_monomorphize | |
| parent | e525bc9592392e8a06e2f277deed4b59f40eaf61 (diff) | |
| parent | a4fbd01af28449de087efae8ecfa05e2264b3601 (diff) | |
| download | rust-fd287d2e88fc7c5a85e544fb2c37223575a53cae.tar.gz rust-fd287d2e88fc7c5a85e544fb2c37223575a53cae.zip | |
Rollup merge of #120773 - Enselic:copy-vs-move, r=oli-obk
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. Part of the "Differentiate between Operand::Move and Operand::Copy" step of https://github.com/rust-lang/rust/issues/83518. r? `@oli-obk` (who I think is still E-mentor?)
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); }; } |
