rust/tests
bors bbb6f68e28 Auto merge of #147803 - jsgf:move-copy-codegen, r=madsmtm,saethlin
Add -Zannotate-moves for profiler visibility of move/copy operations (codegen)

**Note:** this is an alternative implementation of https://github.com/rust-lang/rust/pull/147206; rather than being a MIR transform, it adds the annotations closer to codegen. It's functionally the same but the implementation is lower impact and it could be more correct.

---

This implements a new unstable compiler flag `-Zannotate-moves` that makes move and copy operations visible in profilers by creating synthetic debug information. This is achieved with zero runtime cost by manipulating debug info scopes to make moves/copies appear as calls to `compiler_move<T, SIZE>` and `compiler_copy<T, SIZE>` marker functions in profiling tools.

This allows developers to identify expensive move/copy operations in their code using standard profiling tools, without requiring specialized tooling or runtime instrumentation.

The implementation works at codegen time. When processing MIR operands (`Operand::Move` and `Operand::Copy`), the codegen creates an `OperandRef` with an optional `move_annotation` field containing an `Instance` of the appropriate profiling marker function. When storing the operand, `store_with_annotation()` wraps the store operation in a synthetic debug scope that makes it appear inlined from the marker.

Two marker functions (`compiler_move` and `compiler_copy`) are defined in `library/core/src/profiling.rs`. These are never actually called - they exist solely as debug info anchors.

Operations are only annotated if:
   - We're generating debug info and the feature is enabled.
   - Meets the size threshold (default: 65 bytes, configurable via `-Zannotate-moves=SIZE`), and is non-zero
   - Has a memory representation

This has a very small size impact on object file size. With the default limit it's well under 0.1%, and even with a very small limit of 8 bytes it's still ~1.5%. This could be enabled by default.
2025-11-08 07:57:14 +00:00
..
assembly-llvm Rollup merge of #147355 - sayantn:masked-loads, r=RalfJung,bjorn3 2025-11-05 10:59:18 +11:00
auxiliary Rollup merge of #147355 - sayantn:masked-loads, r=RalfJung,bjorn3 2025-11-05 10:59:18 +11:00
codegen-llvm Add -Zannotate-moves for profiler visibility of move/copy operations 2025-11-06 15:39:45 -08:00
codegen-units pub async fn implementation coroutine (func::{closure#0}) is monomorphized, when func itself is monomorphized 2025-09-01 13:45:00 +07:00
coverage Add coverage scope for controlling paths in code coverage 2025-10-27 12:54:24 +01:00
coverage-run-rustdoc
crashes feat: Use annotate-snippets by default on nightly 2025-11-05 09:01:07 -07:00
debuginfo Minor fixes to StdNonZeroNumberProvider for gdb 2025-11-05 11:42:54 -07:00
incremental Add a fast path for lowering trivial consts 2025-10-25 16:59:53 -04:00
mir-opt Rollup merge of #147925 - fneddy:fix_big_endian_GVN_tests, r=saethlin 2025-11-05 10:59:18 +11:00
pretty Remove QPath::LangItem from ranges 2025-10-27 21:19:38 -05:00
run-make Auto merge of #148573 - matthiaskrgr:rollup-cn5viia, r=matthiaskrgr 2025-11-06 14:52:37 +00:00
run-make-cargo Skip the panic-immediate-abort-works test when cross-compiling 2025-09-22 21:13:38 -04:00
rustdoc Rollup merge of #148213 - GuillaumeGomez:fix-exit-of-expansion, r=yotamofek 2025-11-06 12:29:58 +01:00
rustdoc-gui rustdoc-search: add test case for throbber 2025-10-07 12:59:58 -07:00
rustdoc-js rustdoc-search: remove broken index special case 2025-11-05 23:41:43 -07:00
rustdoc-js-std Add regression test for including derive macros in macro filtering 2025-10-27 16:00:32 +01:00
rustdoc-json Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
rustdoc-ui feat: Use annotate-snippets by default on nightly 2025-11-05 09:01:07 -07:00
ui Auto merge of #147803 - jsgf:move-copy-codegen, r=madsmtm,saethlin 2025-11-08 07:57:14 +00:00
ui-fulldeps When more than a single impl and less than 4 could apply, point at them 2025-10-31 20:44:01 +00:00
COMPILER_TESTS.md