Skip to content

Error messages in report_use_of_moved_value() should be more intelligent. #7286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bblum opened this issue Jun 21, 2013 · 0 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-type-system Area: Type system C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@bblum
Copy link
Contributor

bblum commented Jun 21, 2013

Currently it knows how to emit three possible error messages:

`%s` moved here because it has type `%s`, which is moved by default (use `copy` to override)
`%s` moved here because it has type `%s`, which is moved by default (use `ref` to override)
`%s` moved into closure environment here because its type is moved by default
(make a copy and capture that instead to override)

But there are several situations in which the hints are wrong -- if the type is completely noncopyable, the phrase "moved by default ([hint])" should just be "noncopyable". And, if the type is a stack closure, I'd like it to emit a hint like "Suggest implicitly borrowing the closure with |args...| closure(args...)".

@ghost ghost assigned bblum Jun 22, 2013
@bblum bblum closed this as completed in 313dd37 Jul 4, 2013
@bblum bblum removed their assignment Jun 16, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 3, 2021
Fix ICE in `too_many_lines`

fixes: rust-lang#7272
fixes: rust-lang#7286

rust-lang#7272 looks like it's caused by a bug in rust-c. The span it's giving for the closure is:

```rust
$crate:: $lower($d arg) }
        }
    }
}
```

The correct span would be `$crate:: $lower($d arg)` without all the closing braces.

rust-lang#7286 is definitely a clippy bug

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-type-system Area: Type system C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

1 participant