Skip to content

Structs with duplicate methods do not cause compilation warning or error #7062

Closed
@tikue

Description

@tikue
pub struct Foo;

impl Foo {
    pub fn bar(&self) {
        println("I'm bar 1");
    }

    pub fn bar(&self) {
        println("I'm bar 2");
    }
}

fn main() {
    let foo = Foo;
    foo.bar();
}

The above program compiles and prints I'm bar 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions