This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ fn main() {
6666}
6767
6868enum A {
69- B { b : B } ,
69+ B { b : B } ,
7070}
7171
7272struct A2 ( B ) ;
@@ -77,13 +77,12 @@ enum B {
7777}
7878
7979fn foo ( ) {
80- // We don't want to suggest `A::B(B::Fst)` here.
8180 let a: A = B :: Fst ;
8281 //~^ ERROR mismatched types
82+ //~| HELP try wrapping
8383}
8484
8585fn bar ( ) {
86- // But we _do_ want to suggest `A2(B::Fst)` here!
8786 let a: A2 = B :: Fst ;
8887 //~^ ERROR mismatched types
8988 //~| HELP try wrapping
Original file line number Diff line number Diff line change @@ -191,15 +191,20 @@ LL | let _ = Foo { bar: Some(bar) };
191191 | ++++++++++ +
192192
193193error[E0308]: mismatched types
194- --> $DIR/compatible-variants.rs:81 :16
194+ --> $DIR/compatible-variants.rs:80 :16
195195 |
196196LL | let a: A = B::Fst;
197197 | - ^^^^^^ expected enum `A`, found enum `B`
198198 | |
199199 | 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+ | +++++++++ +
200205
201206error[E0308]: mismatched types
202- --> $DIR/compatible-variants.rs:87 :17
207+ --> $DIR/compatible-variants.rs:86 :17
203208 |
204209LL | let a: A2 = B::Fst;
205210 | -- ^^^^^^ expected struct `A2`, found enum `B`
Original file line number Diff line number Diff line change @@ -26,4 +26,5 @@ struct Context { wrapper: Wrapper }
2626fn overton ( ) {
2727 let _c = Context { wrapper : Payload { } } ;
2828 //~^ ERROR mismatched types
29+ //~| try wrapping the expression in `Wrapper`
2930}
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ error[E0308]: mismatched types
2525 |
2626LL | let _c = Context { wrapper: Payload{} };
2727 | ^^^^^^^^^ 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+ | ++++++++++++++++++ +
2833
2934error: aborting due to 2 previous errors
3035
You can’t perform that action at this time.
0 commit comments