Skip to content

Writing a non-trait impl for a struct in a different module makes it impossible to construct that struct directly #9052

Closed
@huonw

Description

@huonw

Commenting out the impl makes the build succeed.

mod foo {
    use super::*;

    fn bar() -> Foo {
        Foo { x: 1 }
    }
    impl Foo { }
}

pub struct Foo { x: int }

fn main() {}
mod-error.rs:5:8: 5:11 error: `Foo` does not name a structure
mod-error.rs:5         Foo { x: 1 }
                       ^~~
error: aborting due to previous error

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