]> git.lizzy.rs Git - rust.git/commit
Account for `match` expr in single line
authorEsteban Küber <esteban@kuber.com.ar>
Tue, 6 Dec 2022 03:42:21 +0000 (19:42 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Wed, 28 Dec 2022 00:45:55 +0000 (16:45 -0800)
commit05e8ba126c7e4918315a35142d73f4e57fb2bb6b
treea68ecfbbd1fcd9baf706802733d0687f0e4ff13f
parent92c1937a90e5b6f20fa6e87016d6869da363972e
Account for `match` expr in single line

When encountering `match Some(42) { Some(x) => x, None => "" };`, output

```
error[E0308]: `match` arms have incompatible types
 --> f53.rs:2:52
  |
2 |     let _ = match Some(42) { Some(x) => x, None => "" };
  |             --------------              -          ^^ expected integer, found `&str`
  |             |                           |
  |             |                           this is found to be of type `{integer}`
  |             `match` arms have incompatible types
  ```
compiler/rustc_infer/src/infer/error_reporting/mod.rs
src/test/ui/match/single-line.rs [new file with mode: 0644]
src/test/ui/match/single-line.stderr [new file with mode: 0644]