Skip to content

cargo check passes where cargo build fails #8650

Closed
@amling

Description

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions