E0242

? on a Result whose error type is not the enclosing function's error type, with no impl From to convert it. Spans the ? expression.

Machine-applicable fix: none.

Example

This program fails with E0242.

fn parse() -> Result<Int, String> {
    Err("bad")
}

fn run() -> Result<Int, Int> {
    let n = parse()?
    Ok(n)
}

Fixed

The same program, fixed.

fn parse() -> Result<Int, String> {
    Err("bad")
}

fn run() -> Result<Int, String> {
    let n = parse()?
    Ok(n)
}

Listed in the checker notes. oskac explain E0242 prints this entry offline.

All error codes