-
Notifications
You must be signed in to change notification settings - Fork 13.3k
(do not check in yet) Delete json error metadata for a crate if it is out-of-date. #25380
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
Conversation
I could not figure out a good way to encode this solely in makefile rules. Even the approach here is pretty ad-hoc; it is heavily relying on the fact that all rustc crates (and thus all the json files that compiling such crates would generate on the side) have to wait for `libsyntax` to be built before they can be compiled, and thus it should be sound to make this check a prereq for the `stamp.syntax`. (At least, that is what I hope.) Fix rust-lang#25364
(rust_highfive has picked a reviewer for you, use r? to override) |
I don't want a rubber-stamp on this fix; its a small patch, but I really do want a deep review from someone who is knowledgeable in our |
(oh, also, I'm think my setting |
oh wait, this approach might be bad ... it might cause libsyntax to be rebuilt when any rustc crate changes, even when the json file is not deleted. I ... need to think about this. I had considered trying to use an order-only dependency, but I am not sure that can fix things here. I'll leave this PR open in the hopes that a reviewer can suggest a fix, but this should not get checked in until I resolve this. |
Another approach would be to simply delete all of the json metadata files on every build. The only reason I had avoided doing that was that I figured there was an advantage to keeping the metadata files for all the crates as long as they are not stale -- e.g. it will help detect conflicts earlier when But that cost -- of not catching conflicts earlier -- is clearly far lower cost than rebuilding |
The strategy of just scraping a directory and checking uniqueness on each build of a crate seems quite brittle, as it appears you've found out. I think I'd personally prefer to move this kind of validation to |
I assume you mean ... we would still generate the side-channel |
A third option, that is potentially grosser than the previous ones: Make each error diagnostics JSON file encode what source files it was built from, and then the diagnostics plugin checks if any of those files have a time stamp newer than the error diagnostics file itself; if so, the plugin leaves that diagnostics file out of the check. It still has some error scenarios (mostly oriented around newly introduced file submodules or renamed files), but it would work pretty well. There is a fine line indeed between grossness and elegance... |
Yeah I think generating the JSON files is fine (although if tidy can scrape the relevant files that would be even better), but the main idea is that we only check validity after the entire build completes (ensuring the files are up-to-date). I'd personally prefer to avoid lots of infrastructure related to this as it seems like a pretty minor thing to safeguard against. |
Note that there are some compiler panics on the bots right now having to do with invalid JSON, and I suspect that Perhaps it's best to remove this logic entirely and re-add it at a later date? |
I've submitted a PR to temporarily remove the validation: #25592 |
Delete json error metadata for a crate if it is out-of-date.
I could not figure out a good way to encode this solely in makefile rules. Even the approach here is pretty ad-hoc; it is heavily relying on the fact that all rustc crates (and thus all the json files that compiling such crates would generate on the side) have to wait for
libsyntax
to be built before they can be compiled, and thus it should be sound to make this check a prereq for thestamp.syntax
.(At least, that is what I hope.)
Fix #25364