Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upcargo-check reissues warnings between builds for `bin` crates, but not for `lib` #3624
Comments
crumblingstatue
referenced this issue
Jan 31, 2017
Closed
cargo clippy does not show the warnings if executed twice #1495
This comment has been minimized.
This comment has been minimized.
|
This former behavior is what I'd expect because the latter shows that the output is cached, which is definitely isn't! cc @nrc, I think we may be caching something and not rerunning perhaps? |
This comment has been minimized.
This comment has been minimized.
JelteF
commented
Mar 16, 2017
|
Any updates on this? I was hoping that the just released to stable |
This comment has been minimized.
This comment has been minimized.
|
I can try to make a PR, but any pointers as to where to look would be appreciated. |
This comment has been minimized.
This comment has been minimized.
|
@fmdkdd I'm not precisely sure where this would be located but it's pretty likely to be somewhere around |
This comment has been minimized.
This comment has been minimized.
|
I've taken a quick look at this. I don't know much about Cargo internals, but here's what I've found so far. |
This comment has been minimized.
This comment has been minimized.
This is because when running cargo check we are emitting metadata files rather than object files and so we use the |
This comment has been minimized.
This comment has been minimized.
|
The Regardless, a valid fingerprint is generated for lib targets which prevents it from being re-checked. Perhaps the |
This comment has been minimized.
This comment has been minimized.
Sure, any help is appreciated, as I'm not familiar with cargo internals either.
The freshness of the lib target? Seems like a decent approach. I'll try that. |
This comment has been minimized.
This comment has been minimized.
I assume when a user runs if unit.profile.check && unit.pkg.package_id() == cx.ws.current_opt().unwrap().package_id() {
freshness = Freshness::Dirty;
}I haven't thought through what the implications are inside a workspace with multiple packages, and obviously the |
This comment has been minimized.
This comment has been minimized.
|
Great! I was about to post that just testing this: @@ -250,6 +251,10 @@ fn compile<'a, 'cfg: 'a>(cx: &mut Context<'a, 'cfg>,
freshness = Freshness::Dirty;
}
+ if unit.profile.check && unit.target.is_lib() {
+ freshness = Freshness::Dirty;
+ }
+
(dirty, fresh, freshness)
};
jobs.enqueue(cx, unit, Job::new(dirty, fresh), freshness)?;was probably not enough, as it recompiled all libraries, not just the crate one. With your suggestion, the warnings are available on subsequent runs. The downside is performance: testing with cargo itself, it takes around 6sec to
Me neither.
I have no idea what a virtual manifest means in this context, but if it has no real library associated, we probably don't need to override the freshness if |
This comment has been minimized.
This comment has been minimized.
Yea. Someone else opened #2494 as a feature request to cache the messages, but I think that would be a significant project for a limited use case.
I believe in this situation, the top-level manifest in a workspace (using the |
This comment has been minimized.
This comment has been minimized.
I confirm that |
This comment has been minimized.
This comment has been minimized.
I think that should be fine. |
fmdkdd
added a commit
to fmdkdd/cargo
that referenced
this issue
Jul 22, 2017
fmdkdd
referenced this issue
Jul 22, 2017
Closed
Fix `cargo check --lib` not emitting warnings on subsequent runs #4318
carols10cents
added
A-rebuild-detection
C-bug
Command-check
labels
Sep 29, 2017
This comment has been minimized.
This comment has been minimized.
apiraino
commented
Aug 15, 2018
•
|
My IDE autoruns I need to alias cargo check and trick its metadata: |
This comment has been minimized.
This comment has been minimized.
|
Since the output of |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure what the format of an |
This comment has been minimized.
This comment has been minimized.
scottjmaddox
commented
Jan 10, 2019
|
Are there any plans to fix this? It's still pretty annoying. |
crumblingstatue commentedJan 31, 2017
$ cargo new --bin mybin && cd mybin && sed -i '1ifn foo(){}' src/main.rs && cargo check && cargo check:$ cargo new --lib mylib && cd mylib && sed -i '1ifn foo(){}' src/lib.rs && cargo check && cargo check:Which one is the intended behavior for
cargo-check? I personally believe it is useful to reissue warnings. The user might accidentally close or clear the terminal, and might want to get the warnings back without modifying the code.