Skip to content

Super-trait operator doesn't work within trait #18088

@aomader

Description

@aomader

Consider the following simple trait example:

pub trait Indexable<T>: Index<uint, T> {
    fn index2(&self, i: uint) -> &T {
        // Doesn't work:
        // self[i]

        // Does work
        self.index(&i)
    }
}

As you can see by the comments, using the []-operator on self doesn't work directly. Instead, one has to call the index function manually.
It seems like something is broken with operators and super-traits.

$ rustc --version
rustc 0.12.0-nightly (b5ba2f551 2014-10-06 20:27:14 +0000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions