jcaesar / structstruck

Rust nested structs
MIT License
53 stars 3 forks source link

Compile error for double colon #6

Closed ktsakas closed 1 year ago

ktsakas commented 1 year ago

I was writing a proc macro using the syn library and had the following code:

structstruck::strike! {
    struct ItemDefine {
        semantic_token: keywords::semantic,
                                ^---- errors here
        ident: Ident,
        semantic_fields: struct {
            brace_token: token::Brace,
                              ^---- errors here
            fields: Vec<SemanticField>,
        }
    }
}

In the output I see:

structstruck error: Colon in top level of type expression. Did you forget a comma somewhere?

This should be valid I was able to do this in my structs before nesting them.

PS. I am getting around this by using type Brace = token::Brace, but it makes things harder to read.

jcaesar commented 1 year ago

Uff, painful oversight on my part when trying to fix #4. Can you verify that your code works with structstruck 0.4.1?

ktsakas commented 1 year ago

I was playing around in my local machine so I don't have the code anymore, but from the test case in the commit the fix looks good.