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

Unexpected character #5

Closed
utaal opened this issue Dec 20, 2017 · 2 comments
Closed

Unexpected character #5

utaal opened this issue Dec 20, 2017 · 2 comments
Assignees

Comments

@utaal
Copy link

utaal commented Dec 20, 2017

Hi,

I'm trying this on a somewhat complex project, and I'm occasionally getting the following error message when I run cargo +nightly rerast --rules_file=changes.rs --diff

Unexpected character: R at (1:1)

(The second number in brackets -- maybe a character position -- changes every time I run the command)

@davidlattimore
Copy link
Contributor

Thanks for trying Rerast and sorry it's giving such an unhelpful error message. When you say "occasionally" - does it succeed if you rerun the same command on the same source, or is it consistent until you've edited the source? When it happens, can you confirm that "cargo check" succeeds?

I'm assuming the project is one that you can't share? If that's the case, I might need to do an overhaul of the error reporting to try to get the message to be more helpful. Although I should probably do that anyway. I can't find 'Unexpected character' in either the rerast source, nor the rustc source, so I'm not sure where it's coming from.

@davidlattimore
Copy link
Contributor

Woohoo, I just reproduced this and then was able to figure out what was happening. Rerast calls "cargo check" in order to get the rustc command lines needed in order to build the local targets, when doing this, rerast acts as a wrapper around the compiler and prints out the command line as a JSON string which is then picked up and read by the parent rerast process. However if there are multiple build targets - e.g. if there are integration tests - cargo will run the "compiler" (rerast) multiple times in parallel. The outputs were getting interleaved resulting in corrupted JSON. The fix is simple - add -j 0 to the cargo check command line in order to not run things in parallel. I'll also improve the error reporting if/when we do get JSON parse errors. Fix should be in the next release. Sorry for the delay and thanks again for the report.

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

No branches or pull requests

2 participants