Skip to content

Wrong error message with managed boxes #5717

Closed
@dhardy

Description

@dhardy

The compiler reports the wrong error message in this sample (which I don't know whether should be errornous or not; I'm just learning Rust):

fn main() {
    let a = @5;         // immutable

    let mut d = @mut 5; // mutable variable, mutable box
    *d += 5;    // error message about this line, though this is fine
    d = a;      // error doesn't appear if this isn't mentioned

    io::println(fmt!("a, d:\t%d, %d", *a,*d));
}

The message reported is:

dhardy@L10036:~/code/small/rust$ rust run mut.rs 
mut.rs:5:4: 5:6 error: assigning to dereference of const @ pointer
mut.rs:5     *d += 5;
            ^~
error: aborting due to previous error

I'm using the compiler from commit 5f13e9c.

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