Skip to content

mismatched types: data type not inferred by compiler #122184

Open
@kzhui125

Description

@kzhui125
fn main() {
    let arr = vec![1, 2, 3];
    let x1 = (&arr[0..0], &arr[0..0]);
    assert_eq!(x1, (&[], &[]));
}

compiler error:

mismatched types
expected tuple `(&[{integer}], &[{integer}])`
   found tuple `(&[_; 0], &[_; 0])`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coercionsArea: implicit and explicit `expr as Type` coercionsA-inferenceArea: Type inferenceC-discussionCategory: Discussion or questions that doesn't represent real issues.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions