File tree Expand file tree Collapse file tree 9 files changed +44
-35
lines changed Expand file tree Collapse file tree 9 files changed +44
-35
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ fn main() {
1010 let n: usize = 42 ;
1111 this_function_expects_a_double_option ( n) ;
1212 //~^ ERROR mismatched types
13- //~| HELP try using a variant of the expected enum
13+ //~| HELP try wrapping the expression in a variant of `DoubleOption`
1414}
1515
1616
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ LL | this_function_expects_a_double_option(n);
66 |
77 = note: expected enum `DoubleOption<_>`
88 found type `usize`
9- help: try using a variant of the expected enum
9+ help: try wrapping the expression in a variant of `DoubleOption`
1010 |
11- LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
12- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1311LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n));
14- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
12+ | ++++++++++++++++++++++++ +
13+ LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
14+ | ++++++++++++++++++++++++++++++ +
1515
1616error[E0308]: mismatched types
1717 --> $DIR/issue-42764.rs:27:33
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ error[E0308]: mismatched types
22 --> $DIR/fully-qualified-type-name1.rs:5:9
33 |
44LL | x = 5;
5- | ^
6- | |
7- | expected enum `Option`, found integer
8- | help: try using a variant of the expected enum: `Some(5)`
5+ | ^ expected enum `Option`, found integer
96 |
107 = note: expected enum `Option<usize>`
118 found type `{integer}`
9+ help: try wrapping the expression in `Some`
10+ |
11+ LL | x = Some(5);
12+ | +++++ +
1213
1314error: aborting due to previous error
1415
Original file line number Diff line number Diff line change @@ -4,13 +4,14 @@ error[E0308]: mismatched types
44LL | fn bar(x: usize) -> Option<usize> {
55 | ------------- expected `Option<usize>` because of return type
66LL | return x;
7- | ^
8- | |
9- | expected enum `Option`, found `usize`
10- | help: try using a variant of the expected enum: `Some(x)`
7+ | ^ expected enum `Option`, found `usize`
118 |
129 = note: expected enum `Option<usize>`
1310 found type `usize`
11+ help: try wrapping the expression in `Some`
12+ |
13+ LL | return Some(x);
14+ | +++++ +
1415
1516error: aborting due to previous error
1617
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ help: try removing this `?`
1212LL - missing_discourses()?
1313LL + missing_discourses()
1414 |
15- help: try using a variant of the expected enum
15+ help: try wrapping the expression in `Ok`
1616 |
1717LL | Ok(missing_discourses()?)
18- |
18+ | +++ +
1919
2020error: aborting due to previous error
2121
Original file line number Diff line number Diff line change @@ -26,27 +26,29 @@ error[E0308]: mismatched types
2626LL | fn b() -> Option<Foo> {
2727 | ----------- expected `Option<Foo>` because of return type
2828LL | Foo { bar: 1 }
29- | ^^^^^^^^^^^^^^
30- | |
31- | expected enum `Option`, found struct `Foo`
32- | help: try using a variant of the expected enum: `Some(Foo { bar: 1 })`
29+ | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
3330 |
3431 = note: expected enum `Option<Foo>`
3532 found struct `Foo`
33+ help: try wrapping the expression in `Some`
34+ |
35+ LL | Some(Foo { bar: 1 })
36+ | +++++ +
3637
3738error[E0308]: mismatched types
3839 --> $DIR/abridged.rs:28:5
3940 |
4041LL | fn c() -> Result<Foo, Bar> {
4142 | ---------------- expected `Result<Foo, Bar>` because of return type
4243LL | Foo { bar: 1 }
43- | ^^^^^^^^^^^^^^
44- | |
45- | expected enum `Result`, found struct `Foo`
46- | help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })`
44+ | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
4745 |
4846 = note: expected enum `Result<Foo, Bar>`
4947 found struct `Foo`
48+ help: try wrapping the expression in `Ok`
49+ |
50+ LL | Ok(Foo { bar: 1 })
51+ | +++ +
5052
5153error[E0308]: mismatched types
5254 --> $DIR/abridged.rs:39:5
Original file line number Diff line number Diff line change @@ -2,14 +2,16 @@ error[E0308]: mismatched types
22 --> $DIR/pat-type-err-let-stmt.rs:6:29
33 |
44LL | let Ok(0): Option<u8> = 42u8;
5- | ---------- ^^^^
6- | | |
7- | | expected enum `Option`, found `u8`
8- | | help: try using a variant of the expected enum: `Some(42u8)`
5+ | ---------- ^^^^ expected enum `Option`, found `u8`
6+ | |
97 | expected due to this
108 |
119 = note: expected enum `Option<u8>`
1210 found type `u8`
11+ help: try wrapping the expression in `Some`
12+ |
13+ LL | let Ok(0): Option<u8> = Some(42u8);
14+ | +++++ +
1315
1416error[E0308]: mismatched types
1517 --> $DIR/pat-type-err-let-stmt.rs:6:9
Original file line number Diff line number Diff line change @@ -2,14 +2,16 @@ error[E0308]: mismatched types
22 --> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28
33 |
44LL | let _: option::O<()> = ();
5- | ------------- ^^
6- | | |
7- | | expected enum `O`, found `()`
8- | | help: try using a variant of the expected enum: `option::O::Some(())`
5+ | ------------- ^^ expected enum `O`, found `()`
6+ | |
97 | expected due to this
108 |
119 = note: expected enum `O<()>`
1210 found unit type `()`
11+ help: try wrapping the expression in `option::O::Some`
12+ |
13+ LL | let _: option::O<()> = option::O::Some(());
14+ | ++++++++++++++++ +
1315
1416error: aborting due to previous error
1517
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ error[E0308]: mismatched types
22 --> $DIR/issue-46112.rs:9:21
33 |
44LL | fn main() { test(Ok(())); }
5- | ^^
6- | |
7- | expected enum `Option`, found `()`
8- | help: try using a variant of the expected enum: `Some(())`
5+ | ^^ expected enum `Option`, found `()`
96 |
107 = note: expected enum `Option<()>`
118 found unit type `()`
9+ help: try wrapping the expression in `Some`
10+ |
11+ LL | fn main() { test(Ok(Some(()))); }
12+ | +++++ +
1213
1314error: aborting due to previous error
1415
You can’t perform that action at this time.
0 commit comments