Skip to content

Can define a method twice in a trait impl #8153

Closed
@huonw

Description

@huonw
struct Foo;

trait Bar {
    fn bar(&self) -> int;
}
impl Bar for Foo {
    fn bar(&self) -> int {1}
    fn bar(&self) -> int {2}
}

fn main() {
    printfln!(Foo.bar())
}
$ rustc double-def.rs
$ ./double-def
1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions