1
- error: expected one of `@` or `| `, found `: `
2
- --> $DIR/type-ascription-in-pattern.rs:3:10
1
+ error: expected one of `!`, `,`, `. `, `::`, `?`, `{`, `}`, or an operator, found `=> `
2
+ --> $DIR/type-ascription-in-pattern.rs:3:16
3
3
|
4
+ LL | match x {
5
+ | - while parsing this struct
4
6
LL | x: i32 => x,
5
- | ^ --- specifying the type of a pattern isn't supported
6
- | |
7
- | expected one of `@` or `|`
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
8
13
|
9
- help: maybe write a path separator here
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
10
22
|
11
- LL | x::i32 => x,
12
- | ~~
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
41
+ |
42
+ LL ~ match (x {
43
+ LL | x: i32 => x,
44
+ LL | true => 42.,
45
+ LL | false => 0.333,
46
+ LL ~ })
47
+ |
48
+
49
+ error: expected one of `.`, `?`, `{`, or an operator, found `}`
50
+ --> $DIR/type-ascription-in-pattern.rs:7:1
51
+ |
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
13
59
14
60
error: expected one of `...`, `..=`, `..`, or `|`, found `:`
15
- --> $DIR/type-ascription-in-pattern.rs:12 :11
61
+ --> $DIR/type-ascription-in-pattern.rs:11 :11
16
62
|
17
63
LL | 42: i32 => (),
18
64
| ^ --- specifying the type of a pattern isn't supported
19
65
| |
20
66
| expected one of `...`, `..=`, `..`, or `|`
21
67
22
68
error: expected `|`, found `:`
23
- --> $DIR/type-ascription-in-pattern.rs:13 :10
69
+ --> $DIR/type-ascription-in-pattern.rs:12 :10
24
70
|
25
71
LL | _: f64 => (),
26
72
| ^ --- specifying the type of a pattern isn't supported
27
73
| |
28
74
| expected `|`
29
75
30
76
error: expected one of `@` or `|`, found `:`
31
- --> $DIR/type-ascription-in-pattern.rs:14 :10
77
+ --> $DIR/type-ascription-in-pattern.rs:13 :10
32
78
|
33
79
LL | x: i32 => (),
34
80
| ^ --- specifying the type of a pattern isn't supported
@@ -40,15 +86,5 @@ help: maybe write a path separator here
40
86
LL | x::i32 => (),
41
87
| ~~
42
88
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
89
+ error: aborting due to 8 previous errors
53
90
54
- For more information about this error, try `rustc --explain E0308`.
0 commit comments