Skip to content

DST coercions do not work in slices #16864

Closed
@huonw

Description

@huonw
fn main() {
    let x: &[uint] = &[1u];
    let _y = &[x, &[1, 2]];
}
<anon>:3:19: 3:26 error: mismatched types: expected `&[uint]`, found `&[uint, .. 2]` (expected vector, found vector)
<anon>:3     let _y = &[x, &[1, 2]];
                           ^~~~~~~

This may not be a bug, but it does mean that slices constructed like this need to have type annotations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions