Pass a hash of the modification date for cache control#5
Pass a hash of the modification date for cache control#5JustusAdam wants to merge 3 commits intocognitive-engineering-lab:mainfrom
Conversation
|
This seems good. Can you add a test to |
|
I've also thought about adding this as a feature actually, where you can pass some sort of I will make that a separate PR though |
| // | ||
| // Our invariant is, that at each step of the iteration: | ||
| // - If we didn't run out of access to match, our borrow and access are comparable | ||
| // - If we didn't run out of access to match, our borrow and access are comparalegal_flow |
There was a problem hiding this comment.
I think your find/replace was too aggressive :P
|
|
||
| cmd | ||
| .env("RUSTC_WORKSPACE_WRAPPER", path) | ||
| .env("RUSTC_WRAPPER", path) |
There was a problem hiding this comment.
Can you add a brief comment that explains why we have to use RUSTC_WRAPPER instead of RUSTC_WORKSPACE_WRAPPER? Just for posterity. Or you can point to this PR.
| .unwrap(); | ||
|
|
||
| orig_args.remove(hash_check_arg); | ||
| orig_args.remove(hash_check_arg); |
There was a problem hiding this comment.
Is it necessary to .remove twice?
There was a problem hiding this comment.
Oh it's because you're deleting both arguments. Maybe orig_args.drain(hash_check_arg .. hash_check_arg + 2) is clearer?
This passes an additional
--exec-hashargument to rustc which contains a hash of the modification dates for both the cli and the driver application.This invalidates the build cache when the plugin is recompiled.
Caveats: The argument is passed via (encoded) rustflags, which means we can't use
CARGO_WORKSPACE_WRAPPERanymore, because we need the driver to filter out the--exec-hashargument before it hits regular rustc.I'm happy to discuss alternate namings of this argument or alternative means of delivering it but from my experimentation it will only work if we pass it as a rustflags argument or it will not contribute to the cache key cargo/rustc uses.