Add test of incompatible match arm types with multiline arm
This commit is contained in:
parent
a9cd294cf2
commit
f82adf5bdb
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -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`.
|
||||
|
Loading…
Reference in New Issue
Block a user