-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Non-unique argument names should not be allowed in a trait method #104374
Comments
I'd like to take a stab at it. |
This is not something that can be turned into a hard-error straight away, since it would break backwards compatibility. This should probably be made a lint first, then discussion can be had whether or not to promote it to a hard error. |
This has been valid code (no compiler error and no warnings) since Rust 1.0: https://rust.godbolt.org/z/7daPYqce7 And as |
It used to be allowed to have no parameter name at all, so |
Got it. I'll start with a lint. |
Duplicate of #33995. |
I stumbled upon it at bytecodealliance/wasmtime#5259, and I would appreciate rustc's help to avoid such cases. |
I tried this code (see the
A::f
arguments have the same names -a
):I expected to see this happen:
the compiler throws an error.the compiler shows a warning (if enabled). EDIT: The hard error is too much. The lint fits better. See the comments below.Instead, this happened: the compiler accepted this code.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: