ajhahn.de
← Flash
Flash 26 lines
// REJECT probe — definite errors inside bodies are found: an unknown `if`
// condition evaluates both arms, a known-true arm is walked, and a
// container's associated constant and method body are both walked.

fn pick(c bool) usize {
    x := if (c) 1 else 2 / 0 // expect-error: division by zero
    return x
}

fn live() {
    if true {
        _ = 1 / 0 // expect-error: division by zero
    }
}

const Wrapper = struct {
    fd i32,

    const Z = 1 / 0 // expect-error: division by zero

    fn flagged(self Wrapper) usize {
        _ = self
        return 2 / 0 // expect-error: division by zero
    }
}