File tree 4 files changed +15
-5
lines changed
4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ fn main() {
66
66
}
67
67
68
68
enum A {
69
- B { b : B } ,
69
+ B { b : B } ,
70
70
}
71
71
72
72
struct A2 ( B ) ;
@@ -77,13 +77,12 @@ enum B {
77
77
}
78
78
79
79
fn foo ( ) {
80
- // We don't want to suggest `A::B(B::Fst)` here.
81
80
let a: A = B :: Fst ;
82
81
//~^ ERROR mismatched types
82
+ //~| HELP try wrapping
83
83
}
84
84
85
85
fn bar ( ) {
86
- // But we _do_ want to suggest `A2(B::Fst)` here!
87
86
let a: A2 = B :: Fst ;
88
87
//~^ ERROR mismatched types
89
88
//~| HELP try wrapping
Original file line number Diff line number Diff line change @@ -191,15 +191,20 @@ LL | let _ = Foo { bar: Some(bar) };
191
191
| ++++++++++ +
192
192
193
193
error[E0308]: mismatched types
194
- --> $DIR/compatible-variants.rs:81 :16
194
+ --> $DIR/compatible-variants.rs:80 :16
195
195
|
196
196
LL | let a: A = B::Fst;
197
197
| - ^^^^^^ expected enum `A`, found enum `B`
198
198
| |
199
199
| expected due to this
200
+ |
201
+ help: try wrapping the expression in `A::B`
202
+ |
203
+ LL | let a: A = A::B { b: B::Fst };
204
+ | +++++++++ +
200
205
201
206
error[E0308]: mismatched types
202
- --> $DIR/compatible-variants.rs:87 :17
207
+ --> $DIR/compatible-variants.rs:86 :17
203
208
|
204
209
LL | let a: A2 = B::Fst;
205
210
| -- ^^^^^^ expected struct `A2`, found enum `B`
Original file line number Diff line number Diff line change @@ -26,4 +26,5 @@ struct Context { wrapper: Wrapper }
26
26
fn overton ( ) {
27
27
let _c = Context { wrapper : Payload { } } ;
28
28
//~^ ERROR mismatched types
29
+ //~| try wrapping the expression in `Wrapper`
29
30
}
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ error[E0308]: mismatched types
25
25
|
26
26
LL | let _c = Context { wrapper: Payload{} };
27
27
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
28
+ |
29
+ help: try wrapping the expression in `Wrapper`
30
+ |
31
+ LL | let _c = Context { wrapper: Wrapper { payload: Payload{} } };
32
+ | ++++++++++++++++++ +
28
33
29
34
error: aborting due to 2 previous errors
30
35
You can’t perform that action at this time.
0 commit comments