Skip to content

provide on_unimplemented hint for ops::Index #31062

Closed
@durka

Description

@durka

As discussed on IRC. cc @steveklabnik

If you do slice[2i32] you get an error that tells you what is wrong (Index<i32> is not implemented for [T]) but not how to fix it (slices are indexed by usize). A quick fix would be to use #[rustc_on_unimplemented]; it would look like this.

If you are indexing something that isn't [T] then the message would be a false positive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions