diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2025-07-20 01:19:55 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-07-21 16:21:23 +0000 |
| commit | 690ae523e5c0ac9602db7bbe2b8094ee422e4d0f (patch) | |
| tree | 100c056a1b8a370361e9e14c5a2ac288460e4a8e /tests/codegen-llvm/array-optimized.rs | |
| parent | ee3a0783df39cb11c5706e38805eb9258b4fad79 (diff) | |
| download | rust-690ae523e5c0ac9602db7bbe2b8094ee422e4d0f.tar.gz rust-690ae523e5c0ac9602db7bbe2b8094ee422e4d0f.zip | |
Tweak borrowck label pointing at `!Copy` value moved into closure
When encountering a non-`Copy` value that is moved into a closure which is coming directly from a fn parameter, point at the parameter's type when mentioning it is not `Copy`.
Before:
```
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
```
After:
```
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
```
Diffstat (limited to 'tests/codegen-llvm/array-optimized.rs')
0 files changed, 0 insertions, 0 deletions
