Skip to content

Cannot derive Clone when using 'braced_empty_structs' #29548

Closed
@Thinkofname

Description

@Thinkofname

Code:

#![feature(braced_empty_structs)]

#[derive(Clone)]
struct Test {}

fn main() {
}

Playground: https://play.rust-lang.org/?gist=7d3786c5b71415babb04&version=nightly

Error:

<anon>:1:1: 1:1 error: unresolved enum variant, struct or const `Test` [E0419]
<anon>:1 #![feature(braced_empty_structs)]
         ^
<anon>:3:10: 3:15 note: in this expansion of #[derive_Clone] (defined in <anon>)
<anon>:1:1: 1:1 help: see the detailed explanation for E0419
<anon>:3:10: 3:15 error: `Test` is the name of a struct or struct variant, but this expression uses it like a function name [E0423]
<anon>:3 #[derive(Clone)]
                  ^~~~~
<anon>:3:10: 3:15 note: in this expansion of #[derive_Clone] (defined in <anon>)
<anon>:3:10: 3:15 help: see the detailed explanation for E0423
<anon>:3:10: 3:15 help: did you mean to write: `Test { /* fields */ }`?
error: aborting due to 2 previous errors

This should work just like struct Test; unless i'm missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions