-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.
Description
trait Foo {
type bar;
fn bar();
}
is accepted (though generally considered bad style), but is unimplementable:
impl Foo for () {
type bar = ();
fn bar() {
}
}
gives the error "item bar
is an associated method, which doesn't match its trait <() as Foo>
"
This seems kinda silly. Allowing this non-conflicting name reuse might be useful for macros as long as procedural macros don't yet exist and concat_idents is useless. Forbidding it outright seems fine, but should be done at the trait definition.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.