Closed
Description
UPDATE: We've decided to convert this warning into a hard error, but are still waiting for a PR to make that a reality. If you're interested in contributing, there are directions for writing such a PR available here.
This tracking issue pertains to a bug fix for #22889. The problem was that the compiler was accepting two inherent impls that both defined the same method, which creates an obvious ambiguity:
struct Foo;
impl Foo {
fn id() {}
}
impl Foo {
fn id() {}
}
The most obvious fix here is to give one method a distinct name, though sometimes there are other possible rewrites (e.g., one could rewrite the impls to use a double dispatch pattern).
Current status
- Forbid items with the same name from appearing in overlapping inherent impl blocks #31925 introduces the
overlapping_inherent_impls
lint as warn-by-default - Make sufficiently old or low-impact compatibility lints deny-by-default #36894 makes the
overlapping_inherent_impls
lint deny-by-default - PR ? makes the
overlapping_inherent_impls
lint a hard error
Metadata
Metadata
Assignees
Labels
Area: Lints (warnings about flaws in source code) such as unused_mut.Blocker: Implemented in the nightly compiler and unstable.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.In the final comment period and will be merged soon unless new substantive objections are raised.