tailhook / quick-error

A rust-macro which makes errors easy to write

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no rules expected the token `STRUCT`

antage opened this issue · comments

I tried to code an error for quick-xml error (http://tafia.github.io/quick-xml/quick_xml/error/type.ResultPos.html):

quick_error! {
    #[derive(Debug)]
    pub enum DictError {
        XmlError { err: quick_xml::error::Error, pos: usize } {
            from(terr: (quick_xml::error::Error, usize)) -> {
                err: terr.0,
                pos: terr.1,
            }
        }
    }
}

but I got following error:

<quick_error macros>:99:26: 99:42 error: no rules expected the token `STRUCT`
<quick_error macros>:99 $ ( # [ $ bmeta ] ) * => $ bitem : STRUCT [ $ ( $ qvar : $ qtyp ) , * ] ]

I can't realize what's wrong.

It seems a trailing comma (here: pos: terr.1,) causes the error.