-
Notifications
You must be signed in to change notification settings - Fork 750
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
Code generation randomly produces code which does not compile #574
Comments
Thanks for the detailed report. This is the weirdest Serde-related bug I have ever seen! The corrupted code is coming from this line where To help us reproduce this, would it be possible for you to share the entire non-working "event_list_editor_cli" crate? You can email it to me at dtolnay@gmail.com if you don't want it publically on GitHub. Also please include the output of |
Thanks for replying! I can't send you the whole app as it is forbidden by On 6 October 2016 at 17:50, David Tolnay notifications@github.com wrote:
Cheers, |
Closing because I don't think we can make progress on this without being able to reproduce it. Hopefully either nobody else ever hits this, or the next person can work with us to reproduce and fix. |
I am not allowed to send you the whole project and I'll need to strip it down to something that I can share first. That is not currently my top priority, unfortunately. I have not forgotten about this. |
Thanks! I'll reopen when you get to it. |
Looks like #590 has a more promising (open source) way to reproduce the same bug. |
I did manage to repro and stripped out all "confidential" code. |
Trying to attach source code... On 18 October 2016 at 01:32, David Tolnay notifications@github.com wrote:
Cheers, |
Didn't work :/ |
The other ticket reproducing this issue was fixed in Serde 0.8.14. Can you try with serde_codegen >= 0.8.14 and see whether your issue has been fixed as well? |
Trying now with codegen 0.8.16 |
Cool, it seems to be fixed! |
Code generation sometimes fails with corrupted code producing type errors. A workaround is to slightly change the code and retry (adding or removing blank lines works). I don't know if deterministic (so once it builds, it always builds correctly) a or random yet (so any build can randomly fail).
I'm using serde_codegen version 0.8.11
UPDATE: it does look deterministic and it appears to have something to do with the optional trailing commas. I'm using
rustfmt
so the comma is added automatically (and I am not keen on changing this policy):this is the snippet from the .rs.in . "SpeedOfTime" is a field of another struct?
Cargo.toml:
build.rs
The text was updated successfully, but these errors were encountered: