diff options
| -rw-r--r-- | src/test/ui/match/match-incompat-type-semi.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/match/match-incompat-type-semi.stderr | 20 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/test/ui/match/match-incompat-type-semi.rs b/src/test/ui/match/match-incompat-type-semi.rs index 9ab40fa3cce..37f6beabd33 100644 --- a/src/test/ui/match/match-incompat-type-semi.rs +++ b/src/test/ui/match/match-incompat-type-semi.rs @@ -39,4 +39,14 @@ fn main() { None => { //~ ERROR incompatible types }, }; + + let _ = match Some(42) { + Some(x) => "rust-lang.org" + .chars() + .skip(1) + .chain(Some(x as u8 as char)) + .take(10) + .any(char::is_alphanumeric), + None => {} //~ ERROR incompatible types + }; } diff --git a/src/test/ui/match/match-incompat-type-semi.stderr b/src/test/ui/match/match-incompat-type-semi.stderr index 701f15fdc4b..1a2dbbcc29f 100644 --- a/src/test/ui/match/match-incompat-type-semi.stderr +++ b/src/test/ui/match/match-incompat-type-semi.stderr @@ -69,6 +69,24 @@ LL | || }, LL | | }; | |_____- `match` arms have incompatible types -error: aborting due to 4 previous errors +error[E0308]: `match` arms have incompatible types + --> $DIR/match-incompat-type-semi.rs:50:17 + | +LL | let _ = match Some(42) { + | _____________- +LL | | Some(x) => "rust-lang.org" + | |____________________- +LL | || .chars() +LL | || .skip(1) +LL | || .chain(Some(x as u8 as char)) +LL | || .take(10) +LL | || .any(char::is_alphanumeric), + | ||_______________________________________- this is found to be of type `bool` +LL | | None => {} + | | ^^ expected `bool`, found `()` +LL | | }; + | |_____- `match` arms have incompatible types + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. |
