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