Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParseError when implement Display derive for enum #239

Open
qhliang opened this issue Feb 9, 2023 · 2 comments
Open

ParseError when implement Display derive for enum #239

qhliang opened this issue Feb 9, 2023 · 2 comments
Assignees
Labels
Milestone

Comments

@qhliang
Copy link

qhliang commented Feb 9, 2023

Awesome library, i like it!

I found some small problems during use, in some cases, it will be panic. The following is an example:

#[derive(Display)]
#[display(fmt = "{_0}")]
enum NodeType {
    Base(&'static str),
    Main(&'static str),
    N1(&'static str),
    N2(&'static str),
    N3(&'static str),
    N4(&'static str),
}

Here is the compile error result:

error: proc-macro derive panicked
  --> src/main.rs:93:10
   |
93 | #[derive(Display)]
   |          ^^^^^^^
   |
   = help: message: called `Result::unwrap()` on an `Err` value: ParseError { line: 1, column: 2, offset: 1, expected: {"}", "[0-9]", ":"} }

I can't find the cause of the problem from the message.

@qhliang qhliang changed the title ParseError when implement Display derive for struct ParseError when implement Display derive for enum Feb 9, 2023
@tyranron
Copy link
Collaborator

tyranron commented Feb 9, 2023

@ilslv I guess this is not the case anymore on latest master, but maybe you could add tests covering that, just to be sure?

@tyranron tyranron added the bug label Feb 9, 2023
@tyranron tyranron added this to the 1.0.0 milestone Feb 9, 2023
@ilslv
Copy link
Contributor

ilslv commented Feb 10, 2023

@tyranron actually this case doesn't work on master, but for a different reason: we haven't decided yet on how to implement affix #142

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants