Repository: rust
Issue: Tracking Issue for `large_assignments` lint
Labels: A-lints,E-mentor,T-lang,E-help-wanted,E-medium,C-tracking-issue,S-tracking-design-concerns

This is a tracking issue for the implementation of the MCP https://github.com/rust-lang/compiler-team/issues/420
The feature gate for the issue is `#![feature(large_assignments)]`.

### About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

### Steps

- [x] Implement the RFC (https://github.com/rust-lang/rust/pull/83519)
- [x] make sure we inform the user properly about the fact that they can change the limit https://github.com/rust-lang/rust/labels/E-easy
    * this just needs an additional note on the diagnostic informing the user about the current limit and how to change it.
- [x] reduce the noisiness (it's reported multiple times on different parts of an expression, but should only trigger on the innermost/first one) https://github.com/rust-lang/rust/labels/E-easy
    * this can be done by adding the current span to a Vec on `self` in https://github.com/oli-obk/rust/blob/85b1c67910dbeede8aabb16bc0c1c09a2fefe8ab/compiler/rustc_mir/src/monomorphize/collector.rs#L784
    * and then, right before https://github.com/oli-obk/rust/blob/85b1c67910dbeede8aabb16bc0c1c09a2fefe8ab/compiler/rustc_mir/src/monomorphize/collector.rs#L760 checking if the current span overlaps with any span in the vec.
- [x] stop linting in box/arc initialization https://github.com/rust-lang/rust/labels/E-medium
- [x] make span point to specific arg when moving large args into functions (https://github.com/rust-lang/rust/pull/116520)
- [x] Differentiate between `Operand::Move` and `Operand::Copy`, see https://github.com/rust-lang/rust/pull/116310#discussion_r1349506531 and https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/arg.20Spans.20for.20TerminatorKind.3A.3ACall.3F/near/393865180
    * https://github.com/rust-lang/rust/pull/120773
- [ ] Make sure diagnostics point to correct span when `-Zinline-mir` is involed. See https://github.com/rust-lang/rust/issues/121672
- [ ] fix lint duplication with [multiple generic instantiations ](https://github.com/rust-lang/rust/pull/115684#issue-1888409314)
- [ ] [Suggest](https://github.com/rust-lang/rust/pull/121539#issuecomment-1962305010) borrow instead of `#[allow(...)]` if possible
- [ ] enable the lint by default with a 4k threshold (https://github.com/rust-lang/rust/pull/115684)
- [ ] disable the lint in tests (by default, users can still turn it on) https://github.com/rust-lang/rust/labels/E-medium
- [ ] move lint logic out of compiler/rustc_monomorphize/src/collector.rs (we should do this after we enable the lint by default since doing this has a high risk of regressing performance)
- [ ] Adjust documentation ([see instructions on rustc-dev-guide][doc-guide])
- [ ] Stabilization PR ([see instructions on rustc-dev-guide][stabilization-guide])

[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs

### Unresolved Questions

* Should this threshold be configurable via the command line?
* Should we split lint into multiple size limits lints?

### Implementation history

* [https://github.com/rust-lang/rust/pull/83519](implementation)

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":null}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->