rust/tests
Matthias Krüger 33a9e4f821
Rollup merge of #144200 - estebank:dont-point-at-closure, r=lcnr
Tweak output for non-`Clone` values moved into closures

When we encounter a non-`Clone` value being moved into a closure, try to find the corresponding type of the binding being moved, if it is a `let`-binding or a function parameter. If any of those cases, we point at them with the note explaining that the type is not `Copy`, instead of giving that label to the place where it is captured. When it is a `let`-binding with no explicit type, we point at the initializer (if it fits in a single line).

```
error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure
  --> f111.rs:14:25
   |
13 | fn do_stuff(foo: Option<Foo>) {
   |             ---  ----------- move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait
   |             |
   |             captured outer variable
14 |     require_fn_trait(|| async {
   |                      -- ^^^^^ `foo` is moved here
   |                      |
   |                      captured by this `Fn` closure
15 |         if foo.map_or(false, |f| f.foo()) {
   |            --- variable moved due to use in coroutine
```

instead of

```
error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure
  --> f111.rs:14:25
   |
13 | fn do_stuff(foo: Option<Foo>) {
   |             --- captured outer variable
14 |     require_fn_trait(|| async {
   |                      -- ^^^^^ `foo` is moved here
   |                      |
   |                      captured by this `Fn` closure
15 |         if foo.map_or(false, |f| f.foo()) {
   |            ---
   |            |
   |            variable moved due to use in coroutine
   |            move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait
```
2025-07-25 11:16:36 +02:00
..
assembly-llvm Rename tests/codegen into tests/codegen-llvm 2025-07-22 14:28:48 +02:00
auxiliary So many test updates x_x 2025-07-20 10:15:14 -07:00
codegen-llvm Rename tests/codegen into tests/codegen-llvm 2025-07-22 14:28:48 +02:00
codegen-units Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obk 2025-06-27 12:57:05 +00:00
coverage coverage: Enlarge empty spans during MIR instrumentation, not codegen 2025-07-22 19:49:54 +10:00
coverage-run-rustdoc
crashes Auto merge of #144389 - scottmcm:no-more-mir-cast-assume, r=davidtwco 2025-07-24 20:38:53 +00:00
debuginfo tests: {Meta,Pointee}Sized in non-minicore tests 2025-06-16 23:04:33 +00:00
incremental Bless incremental tests. 2025-07-13 13:50:01 +00:00
mir-opt Auto merge of #144389 - scottmcm:no-more-mir-cast-assume, r=davidtwco 2025-07-24 20:38:53 +00:00
pretty Update uitest stderrs 2025-07-23 13:33:23 +02:00
run-make Rollup merge of #144218 - Noratrieb:target-spec-json-de-jank, r=fee1-dead 2025-07-24 15:08:22 +02:00
rustdoc Regression test 2025-07-17 08:03:17 +02:00
rustdoc-gui Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00
rustdoc-js Add test for aliases partial match 2025-07-16 14:27:22 +02:00
rustdoc-js-std Add test for aliases partial match 2025-07-16 14:27:22 +02:00
rustdoc-json rustdoc-json: Structured attributes 2025-07-15 16:52:41 +00:00
rustdoc-ui Specify of_trait in Target::Impl. 2025-07-17 22:21:21 +00:00
ui Rollup merge of #144200 - estebank:dont-point-at-closure, r=lcnr 2025-07-25 11:16:36 +02:00
ui-fulldeps use RustcPublic instead of StableMir 2025-07-18 18:49:32 +00:00
COMPILER_TESTS.md