Skip to content

Duplicate argument names silently allowed in trait methods and fn pointers. #140087

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

Closed
theemathas opened this issue Apr 20, 2025 · 1 comment
Closed
Labels
C-bug Category: This is a bug.

Comments

@theemathas
Copy link
Contributor

theemathas commented Apr 20, 2025

I tried this code:

pub trait Trait {
    fn foo(x: i32, x: i32);
}

pub fn bar() {
    let _: fn(y: i32, y: i32);
}

I expected to get two warnings and/or errors, due to the duplicate function argument names. However, the code compiles fine without warnings.

See also #140088

Meta

Issue reproduces on the playground with version 1.88.0-nightly (2025-04-07 e643f59f6da3a84f43e7)

@theemathas theemathas added the C-bug Category: This is a bug. label Apr 20, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 20, 2025
@fmease
Copy link
Member

fmease commented Apr 20, 2025

Duplicate of #33995 / #104374.

@fmease fmease closed this as completed Apr 20, 2025
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants