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

cargo check passes where cargo build fails #8650

Closed
amling opened this issue Aug 25, 2020 · 3 comments · Fixed by #8677
Closed

cargo check passes where cargo build fails #8650

amling opened this issue Aug 25, 2020 · 3 comments · Fixed by #8677
Labels
A-documenting-cargo-itself Area: Cargo's documentation C-bug Category: bug E-easy Experience: Easy

Comments

@amling
Copy link

amling commented Aug 25, 2020

The code is obviously silly, but I did run into the essential problem genuinely:

fn foo(f: impl Fn()) {
    f();

    foo(&f);
}

fn main() {
    foo(|| {});
}

cargo check does mention unconditional recursion although that's not the real problem and that warning can be dodged (without fixing cargo build) by making the code a little more complicated.

I had assumed that cargo check passing where cargo build failed was a bug, but I've been told by @dtolnay that that's not quite true. He did say to file the bug anyway?

cargo 1.42.1, rustc 1.42.0

@amling amling added the C-bug Category: bug label Aug 25, 2020
@ehuss
Copy link
Contributor

ehuss commented Aug 25, 2020

Thanks for the report! This gets reported occasionally, but is unfortunately the nature of how cargo check works. It does all compilation steps except for code generation. Some diagnostics and errors are only emitted during code generation, so they inherently won't be reported with cargo check.

This is a rustc issue (see rust-lang/rust#49292, rust-lang/rust#61330, rust-lang/rust#70923, etc.).

I'm going to leave this open to at least add a note to Cargo's documentation that not all errors are reported via cargo check.

@ehuss ehuss added A-documenting-cargo-itself Area: Cargo's documentation E-easy Experience: Easy labels Aug 25, 2020
@Rustin170506
Copy link
Member

Can I working on this?

@ehuss
Copy link
Contributor

ehuss commented Sep 3, 2020

@Rustin-Liu Go ahead! Just needs a sentence added to the end of the Description in the cargo-check man page. There is documentation at https://github.com/rust-lang/cargo/tree/master/src/doc on how to rebuild the man pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation C-bug Category: bug E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants