rust/src/test/ui/issues/issue-11319.rs
Esteban Küber 9e934e2215 Reweork incompatible match arms error
- Point at the body expression of the match arm with the type error.
- Point at the prior match arms explicitely stating the evaluated type.
- Point at the entire match expr in a secondary span, instead of primary.
- For type errors in the first match arm, the cause is outside of the
  match, treat as implicit block error to give a more appropriate error.
2019-02-07 05:39:54 -08:00

15 lines
431 B
Rust

fn main() {
match Some(10) {
//~^ NOTE `match` arms have incompatible types
Some(5) => false,
//~^ NOTE this is found to be of type `bool`
Some(2) => true,
//~^ NOTE this is found to be of type `bool`
None => (),
//~^ ERROR match arms have incompatible types
//~| NOTE expected bool, found ()
//~| NOTE expected type `bool`
_ => true
}
}