-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Improve error message when moving out of a &-reference #15457
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
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-diagnostics
Working group: Diagnostics
Comments
Also reported in #25507 (comment) |
Possible final output:
|
Output with #61147 applied:
If applying the suggestion, we'll emit
|
Current output:
|
Triage: no change (playground). I believe the original suggestion of pointing to |
Current output with struct Type {
option: Option<Vec<u8>>
}
impl Type {
fn method(&self) -> Option<Vec<u8>> {
self.option.as_ref().map(|x| x)
}
}
fn main() {
let _ = Type { option: None }.method();
}
|
Current output
|
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
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-diagnostics
Working group: Diagnostics
It would be nice if the following error message
would give a hint why exactly something was moved in the following code
Ideally "map takes option by value" or something like that.
The text was updated successfully, but these errors were encountered: