Skip to content

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

Closed
@MatejLach

Description

@MatejLach

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions