Skip to content

mutability is not inherited through fixed-length vectors #3226

Closed
@nikomatsakis

Description

@nikomatsakis

The following program:

type two_ints = [int * 2];

fn main() {
    let mut foo: two_ints = [0, 1];
    foo[0] = foo[1];
}

erroneously yields:

/Users/nmatsakis/tmp/foo.rs:5:4: 5:9 error: assigning to immutable vec content
/Users/nmatsakis/tmp/foo.rs:5     foo[0] = foo[1];
                                  ^~~~~
error: aborting due to previous error

Note that using a ~[] vec compiles successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsA-type-systemArea: Type systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions