Skip to content

Type inference for indexing #21649

Closed
@Zoxc

Description

@Zoxc

This example used to work:

fn main() {
    let array = [true, false];

    for i in 0..1 { 
        println!("{}", array[i]);
    }
}

Recently you'll get the error: error: the trait``core::ops::Index<i32>``is not implemented for the type``[bool]``[E0277]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions