1- error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, `}`, or an operator, found `=>`
2- --> $DIR/type-ascription-in-pattern.rs:3:16
3- |
4- LL | match x {
5- | - while parsing this struct
6- LL | x: i32 => x,
7- | -^^ expected one of 8 possible tokens
8- | |
9- | help: try adding a comma: `,`
10-
11- error: expected identifier, found keyword `true`
12- --> $DIR/type-ascription-in-pattern.rs:4:9
13- |
14- LL | match x {
15- | - while parsing this struct
16- LL | x: i32 => x,
17- LL | true => 42.,
18- | ^^^^ expected identifier, found keyword
19-
20- error: expected identifier, found keyword `false`
21- --> $DIR/type-ascription-in-pattern.rs:5:9
22- |
23- LL | match x {
24- | - while parsing this struct
25- ...
26- LL | false => 0.333,
27- | ^^^^^ expected identifier, found keyword
28-
29- error: struct literals are not allowed here
30- --> $DIR/type-ascription-in-pattern.rs:2:11
31- |
32- LL | match x {
33- | ___________^
34- LL | | x: i32 => x,
35- LL | | true => 42.,
36- LL | | false => 0.333,
37- LL | | }
38- | |_____^
39- |
40- help: surround the struct literal with parentheses
1+ error: expected one of `@` or `|`, found `:`
2+ --> $DIR/type-ascription-in-pattern.rs:3:10
413 |
42- LL ~ match (x {
434LL | x: i32 => x,
44- LL | true => 42.,
45- LL | false => 0.333,
46- LL ~ })
5+ | ^ --- specifying the type of a pattern isn't supported
6+ | |
7+ | expected one of `@` or `|`
478 |
48-
49- error: expected one of `.`, `?`, `{`, or an operator, found `}`
50- --> $DIR/type-ascription-in-pattern.rs:7:1
9+ help: maybe write a path separator here
5110 |
52- LL | match x {
53- | ----- while parsing this `match` expression
54- ...
55- LL | }
56- | - expected one of `.`, `?`, `{`, or an operator
57- LL | }
58- | ^ unexpected token
11+ LL | x::i32 => x,
12+ | ~~
5913
6014error: expected one of `...`, `..=`, `..`, or `|`, found `:`
61- --> $DIR/type-ascription-in-pattern.rs:11 :11
15+ --> $DIR/type-ascription-in-pattern.rs:12 :11
6216 |
6317LL | 42: i32 => (),
6418 | ^ --- specifying the type of a pattern isn't supported
6519 | |
6620 | expected one of `...`, `..=`, `..`, or `|`
6721
6822error: expected `|`, found `:`
69- --> $DIR/type-ascription-in-pattern.rs:12 :10
23+ --> $DIR/type-ascription-in-pattern.rs:13 :10
7024 |
7125LL | _: f64 => (),
7226 | ^ --- specifying the type of a pattern isn't supported
7327 | |
7428 | expected `|`
7529
7630error: expected one of `@` or `|`, found `:`
77- --> $DIR/type-ascription-in-pattern.rs:13 :10
31+ --> $DIR/type-ascription-in-pattern.rs:14 :10
7832 |
7933LL | x: i32 => (),
8034 | ^ --- specifying the type of a pattern isn't supported
@@ -86,5 +40,15 @@ help: maybe write a path separator here
8640LL | x::i32 => (),
8741 | ~~
8842
89- error: aborting due to 8 previous errors
43+ error[E0308]: mismatched types
44+ --> $DIR/type-ascription-in-pattern.rs:3:19
45+ |
46+ LL | fn foo(x: bool) -> i32 {
47+ | --- expected `i32` because of return type
48+ LL | match x {
49+ LL | x: i32 => x,
50+ | ^ expected `i32`, found `bool`
51+
52+ error: aborting due to 5 previous errors
9053
54+ For more information about this error, try `rustc --explain E0308`.
0 commit comments