Skip to content

Cannot compile when using ensure! #372

@photino

Description

@photino

When I upgrade anyhow to 1.0.85, it fails to compile our project zino.

After some struggles, I find that the latest change of ensure fails to compile the following code:

fn main() -> anyhow::Result<()> {
    let a = 5;
    let b = 3;
    // Can compile
    anyhow::ensure!(a <= b || (a - b) <= 10, "always true");
    // Cannot compile
    anyhow::ensure!(a <= b || a - b <= 10, "always true");
    Ok(())
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions