Skip to content
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

Unclear error message "partially moved value"... #15630

Closed
MatejLach opened this issue Jul 12, 2014 · 0 comments · Fixed by #17434
Closed

Unclear error message "partially moved value"... #15630

MatejLach opened this issue Jul 12, 2014 · 0 comments · Fixed by #17434
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@MatejLach
Copy link
Contributor

Consider the following code:

fn main() {
    let x = box 5i;
    let y = x;
    println!("{}", *x);
}

This yields error: use of partially moved value: *x.
What exactly is a "partially moved value"?
I think that a value should either be moved, or not be moved.
Perhaps a cleaner message could be:
"x" is no longer a valid pointer, did you mean "y"? or something along these lines.

ftxqxd added a commit to ftxqxd/rust that referenced this issue Oct 2, 2014
Previously it output `partially moved` to eagerly. This updates it to be more
accurate and output `collaterally moved` for use of values that were invalidated
by moves out of different fields in the same struct.

Closes rust-lang#15630.
bors added a commit that referenced this issue Oct 2, 2014
This was originally part of #17215.

Closes #15506.
Closes #15630.
Closes #17263.

This also partially implements #15838.
tvallotton pushed a commit to tvallotton/rust that referenced this issue Dec 15, 2023
…ert_tuple_struct_to_named_struct/handle_refs_inside_macro_invocations, r=Veykril

Fix incorrectly replacing references in macro invocation in "Convert to named struct" assist

Fixes rust-lang#15630.

Complements rust-lang#13647 (same assist but missed this one), rust-lang#14920 (inverse action assist).
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants