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

formatting races with rustc, causing compile errors to have wrong locations #9

Closed
programmerjake opened this issue Mar 1, 2024 · 2 comments · Fixed by #10 or paritytech/orchestra#74

Comments

@programmerjake
Copy link

when using Expander::fmt, rustc often reads the generated file before rustfmt has finished running, causing the compile errors to be based on the unformatted code, making the locations not match the formatted code.

This is because expand_to_file uses Command::spawn instead of Command::status or similar and doesn't wait for rustfmt to finish before returning.

@drahnr
Copy link
Owner

drahnr commented Mar 2, 2024

Thank you for filing the issue! I encountered the issue very sporadically but didn't get around to debug it.

Would you'd like to create a PR? Otherwise I'll do it in a few hours.

Note that a failure to format should only emit a warning, and not break compilation

drahnr added a commit that referenced this issue Mar 2, 2024
@drahnr
Copy link
Owner

drahnr commented Mar 2, 2024

@programmerjake could you give #10 a spin, it does work for me.

If I don't hear back from you by Monday, I'll cut a 2.1.0 release including PR #10.

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

Successfully merging a pull request may close this issue.

2 participants