Skip to content

Order of type parameter declarations matters #3394

@catamorphism

Description

@catamorphism
trait A {
  fn a<X, Y>(c: X);
}

struct B {
 x: int;
}

impl B: A {
  fn a<Y, X>(c: X) {}
}

This fails with:

/Users/TimChevalier/rust/src/test/run-pass/issue-2611-2.rs:15:2: 15:21 error: method `a` has an incompatible type: expected type parameter but found type parameter
/Users/TimChevalier/rust/src/test/run-pass/issue-2611-2.rs:15   fn a<Y, X>(c: X) {}
                                                                ^~~~~~~~~~~~~~~~~~~

I think it should pass, since simply reordering the ty param bindings doesn't change meaning. It would be kind of a pain to fix this right now since ty params are still positional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions