Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloaded function error not caught with multiple impls #35763

Closed
nrc opened this issue Aug 17, 2016 · 4 comments
Closed

Overloaded function error not caught with multiple impls #35763

nrc opened this issue Aug 17, 2016 · 4 comments

Comments

@nrc
Copy link
Member

nrc commented Aug 17, 2016

E.g.,

struct Type;

impl Type {
  fn a(_x: (), _y: ()) -> () {
  }
}
impl Type {
  fn a(_x: ()) -> () {
  }
}

fn main() {
}

Putting the two as into the same impl gives the expected error.

From rust-lang/rfcs#1614

@nagisa
Copy link
Member

nagisa commented Aug 17, 2016

I’m pretty sure we have a bug for this already, but my search skills fail me.

@Mark-Simulacrum
Copy link
Member

@nagisa You were probably thinking of the rfcs#1614 issue (from which this was created). I couldn't find anything else similar either.

@durka
Copy link
Contributor

durka commented Aug 18, 2016

There was #31925 but I guess that only caught duplicates with the same signature?

@Mark-Simulacrum
Copy link
Member

This works today. I believe that src/test/ui/codemap_tests/overlapping_inherent_impls.rs tests this, so closing.

error[E0592]: duplicate definitions with name `a`
 --> test.rs:4:3
  |
4 | /   fn a(_x: (), _y: ()) -> () {
5 | |   }
  | |___^ duplicate definitions for `a`
...
8 | /   fn a(_x: ()) -> () {
9 | |   }
  | |___- other definition for `a`

error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants