File tree 4 files changed +59
-0
lines changed
4 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ enum Bug < S > {
2
+ Var = {
3
+ let x: S = 0 ; //~ ERROR: mismatched types
4
+ 0
5
+ } ,
6
+ }
7
+
8
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0308]: mismatched types
2
+ --> $DIR/issue-67945-1.rs:3:20
3
+ |
4
+ LL | enum Bug<S> {
5
+ | - this type parameter
6
+ LL | Var = {
7
+ LL | let x: S = 0;
8
+ | - ^ expected type parameter `S`, found integer
9
+ | |
10
+ | expected due to this
11
+ |
12
+ = note: expected type parameter `S`
13
+ found type `{integer}`
14
+
15
+ error: aborting due to previous error
16
+
17
+ For more information about this error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
1
+ #![ feature( type_ascription) ]
2
+
3
+ enum Bug < S > {
4
+ Var = 0 : S ,
5
+ //~^ ERROR: mismatched types
6
+ //~| ERROR: mismatched types
7
+ }
8
+
9
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0308]: mismatched types
2
+ --> $DIR/issue-67945-2.rs:4:11
3
+ |
4
+ LL | enum Bug<S> {
5
+ | - this type parameter
6
+ LL | Var = 0: S,
7
+ | ^ expected type parameter `S`, found integer
8
+ |
9
+ = note: expected type parameter `S`
10
+ found type `{integer}`
11
+
12
+ error[E0308]: mismatched types
13
+ --> $DIR/issue-67945-2.rs:4:11
14
+ |
15
+ LL | enum Bug<S> {
16
+ | - this type parameter
17
+ LL | Var = 0: S,
18
+ | ^^^^ expected `isize`, found type parameter `S`
19
+ |
20
+ = note: expected type `isize`
21
+ found type parameter `S`
22
+
23
+ error: aborting due to 2 previous errors
24
+
25
+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments