dtolnay/anyhow

Cannot compile when using `ensure!`

Closed this issue · 1 comments

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(())
}

Sorry about the breakage. I have published a fix in 1.0.86.