File tree 2 files changed +30
-2
lines changed
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,11 @@ fn main() {
38
38
let u = 3 ;
39
39
let s = S { u } ;
40
40
//~^ ERROR mismatched types
41
+ let s = S { u : u } ;
42
+ //~^ ERROR mismatched types
41
43
let i = & 4 ;
42
44
let r = R { i } ;
43
45
//~^ ERROR mismatched types
46
+ let r = R { i : i } ;
47
+ //~^ ERROR mismatched types
44
48
}
Original file line number Diff line number Diff line change @@ -81,7 +81,19 @@ LL | let s = S { u };
81
81
found type `{integer}`
82
82
83
83
error[E0308]: mismatched types
84
- --> $DIR/deref-suggestion.rs:42:17
84
+ --> $DIR/deref-suggestion.rs:41:20
85
+ |
86
+ LL | let s = S { u: u };
87
+ | ^
88
+ | |
89
+ | expected &u32, found integer
90
+ | help: consider borrowing here: `&u`
91
+ |
92
+ = note: expected type `&u32`
93
+ found type `{integer}`
94
+
95
+ error[E0308]: mismatched types
96
+ --> $DIR/deref-suggestion.rs:44:17
85
97
|
86
98
LL | let r = R { i };
87
99
| ^
@@ -92,6 +104,18 @@ LL | let r = R { i };
92
104
= note: expected type `u32`
93
105
found type `&{integer}`
94
106
95
- error: aborting due to 8 previous errors
107
+ error[E0308]: mismatched types
108
+ --> $DIR/deref-suggestion.rs:46:20
109
+ |
110
+ LL | let r = R { i: i };
111
+ | ^
112
+ | |
113
+ | expected u32, found &{integer}
114
+ | help: consider dereferencing the borrow: `*i`
115
+ |
116
+ = note: expected type `u32`
117
+ found type `&{integer}`
118
+
119
+ error: aborting due to 10 previous errors
96
120
97
121
For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments