Skip to content

Remove tuple structs with inaccessible fields completely from the value namespace #902

Closed
@ftxqxd

Description

@ftxqxd

This would be a very minor change. To give an example of what this would do, the following code would work under this change:

use foo::Foo;

mod foo {
    pub struct Foo(());
}

const Foo: () = ();

fn main() {
    let x = Foo;
}

Currently, it doesn’t because the import at the top conflicts with the const Foo, even though the tuple struct Foo is unusable as a value (because it has private fields). This would be a very minor backwards-compatible change, but would make using tuple structs with private fields less bad (equivalent to a normal struct with private fields, I think). cc rust-lang/rust#22045

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions