Skip to content

nonminimal_bool can take excessive time #13206

Closed
@weaversa

Description

@weaversa

Description

Here is a source file with a function that computes the value of a small set of clauses on 6 Boolean variables.

$ more src/main.rs 
fn g(a:bool, b:bool, c:bool, d:bool, e:bool, f:bool) -> bool {
    (a && c && f) || (!a && b && !d) || (!b && !c && !e) || (d && e && !f)
}

Running clippy on this file takes ~3 minutes (I believe) due to nonminimal_bool. Many such other Boolean functions cause similar behavior, but here I provide one small example.

$ cargo clippy
    Checking test v0.1.0 (/test)
...
warning: `test` (bin "test") generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 2m 46s

I couldn't find another other ticket that exposed this issue, so consider this chiefly something to be aware of. To a lesser extent, I would appreciate knowing if there is a way to turn off the specific clippy feature that is causing the runtime to take so long.

Version

rustc 1.69.0-nightly (5e37043d6 2023-01-22)
binary: rustc
commit-hash: 5e37043d63bfe2f3be8fa5a05b07d6c0dad5775d
commit-date: 2023-01-22
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions