-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Multiple params in the same param list with the same name are accepted #17568
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
Milestone
Comments
Nominating; looks like a back-compat issue. |
P-backcompat-lang, 1.0. |
pcwalton
added a commit
to pcwalton/rust
that referenced
this issue
Oct 9, 2014
parameter list. This breaks code like: fn f(a: int, a: int) { ... } fn g<T,T>(a: T) { ... } Change this code to not use the same name for a parameter. For example: fn f(a: int, b: int) { ... } fn g<T,U>(a: T) { ... } Code like this is *not* affected, since `_` is not an identifier: fn f(_: int, _: int) { ... } // OK Closes rust-lang#17568. [breaking-change]
bors
added a commit
that referenced
this issue
Oct 9, 2014
…list, r=alexcrichton parameter list. This breaks code like: fn f(a: int, a: int) { ... } fn g<T,T>(a: T) { ... } Change this code to not use the same name for a parameter. For example: fn f(a: int, b: int) { ... } fn g<T,U>(a: T) { ... } Code like this is *not* affected, since `_` is not an identifier: fn f(_: int, _: int) { ... } // OK Closes #17568. r? @alexcrichton [breaking-change]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both type and value parameters. This compiles just fine, short of the unused-variable warnings:
That seems like a fairly useless feature, I imagine people would only ever do this by accident and then get fairly confused about why the "wrong" parameter is being used, if they somehow don't run into type errors. So I am posting this here in the hope it is a bug and not something that needs an RFC to be fixed.
This is half a duplicate of #15969 but not a duplicate of the issue that is a duplicate of, imo.
The text was updated successfully, but these errors were encountered: