File tree 9 files changed +44
-35
lines changed
9 files changed +44
-35
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ fn main() {
10
10
let n: usize = 42 ;
11
11
this_function_expects_a_double_option ( n) ;
12
12
//~^ ERROR mismatched types
13
- //~| HELP try using a variant of the expected enum
13
+ //~| HELP try wrapping the expression in a variant of `DoubleOption`
14
14
}
15
15
16
16
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ LL | this_function_expects_a_double_option(n);
6
6
|
7
7
= note: expected enum `DoubleOption<_>`
8
8
found type `usize`
9
- help: try using a variant of the expected enum
9
+ help: try wrapping the expression in a variant of `DoubleOption`
10
10
|
11
- LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
12
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13
11
LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n));
14
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
12
+ | ++++++++++++++++++++++++ +
13
+ LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
14
+ | ++++++++++++++++++++++++++++++ +
15
15
16
16
error[E0308]: mismatched types
17
17
--> $DIR/issue-42764.rs:27:33
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ error[E0308]: mismatched types
2
2
--> $DIR/fully-qualified-type-name1.rs:5:9
3
3
|
4
4
LL | 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
9
6
|
10
7
= note: expected enum `Option<usize>`
11
8
found type `{integer}`
9
+ help: try wrapping the expression in `Some`
10
+ |
11
+ LL | x = Some(5);
12
+ | +++++ +
12
13
13
14
error: aborting due to previous error
14
15
Original file line number Diff line number Diff line change @@ -4,13 +4,14 @@ error[E0308]: mismatched types
4
4
LL | fn bar(x: usize) -> Option<usize> {
5
5
| ------------- expected `Option<usize>` because of return type
6
6
LL | 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`
11
8
|
12
9
= note: expected enum `Option<usize>`
13
10
found type `usize`
11
+ help: try wrapping the expression in `Some`
12
+ |
13
+ LL | return Some(x);
14
+ | +++++ +
14
15
15
16
error: aborting due to previous error
16
17
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ help: try removing this `?`
12
12
LL - missing_discourses()?
13
13
LL + missing_discourses()
14
14
|
15
- help: try using a variant of the expected enum
15
+ help: try wrapping the expression in `Ok`
16
16
|
17
17
LL | Ok(missing_discourses()?)
18
- |
18
+ | +++ +
19
19
20
20
error: aborting due to previous error
21
21
Original file line number Diff line number Diff line change @@ -26,27 +26,29 @@ error[E0308]: mismatched types
26
26
LL | fn b() -> Option<Foo> {
27
27
| ----------- expected `Option<Foo>` because of return type
28
28
LL | 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`
33
30
|
34
31
= note: expected enum `Option<Foo>`
35
32
found struct `Foo`
33
+ help: try wrapping the expression in `Some`
34
+ |
35
+ LL | Some(Foo { bar: 1 })
36
+ | +++++ +
36
37
37
38
error[E0308]: mismatched types
38
39
--> $DIR/abridged.rs:28:5
39
40
|
40
41
LL | fn c() -> Result<Foo, Bar> {
41
42
| ---------------- expected `Result<Foo, Bar>` because of return type
42
43
LL | 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`
47
45
|
48
46
= note: expected enum `Result<Foo, Bar>`
49
47
found struct `Foo`
48
+ help: try wrapping the expression in `Ok`
49
+ |
50
+ LL | Ok(Foo { bar: 1 })
51
+ | +++ +
50
52
51
53
error[E0308]: mismatched types
52
54
--> $DIR/abridged.rs:39:5
Original file line number Diff line number Diff line change @@ -2,14 +2,16 @@ error[E0308]: mismatched types
2
2
--> $DIR/pat-type-err-let-stmt.rs:6:29
3
3
|
4
4
LL | 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
+ | |
9
7
| expected due to this
10
8
|
11
9
= note: expected enum `Option<u8>`
12
10
found type `u8`
11
+ help: try wrapping the expression in `Some`
12
+ |
13
+ LL | let Ok(0): Option<u8> = Some(42u8);
14
+ | +++++ +
13
15
14
16
error[E0308]: mismatched types
15
17
--> $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
2
2
--> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28
3
3
|
4
4
LL | 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
+ | |
9
7
| expected due to this
10
8
|
11
9
= note: expected enum `O<()>`
12
10
found unit type `()`
11
+ help: try wrapping the expression in `option::O::Some`
12
+ |
13
+ LL | let _: option::O<()> = option::O::Some(());
14
+ | ++++++++++++++++ +
13
15
14
16
error: aborting due to previous error
15
17
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ error[E0308]: mismatched types
2
2
--> $DIR/issue-46112.rs:9:21
3
3
|
4
4
LL | 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 `()`
9
6
|
10
7
= note: expected enum `Option<()>`
11
8
found unit type `()`
9
+ help: try wrapping the expression in `Some`
10
+ |
11
+ LL | fn main() { test(Ok(Some(()))); }
12
+ | +++++ +
12
13
13
14
error: aborting due to previous error
14
15
You can’t perform that action at this time.
0 commit comments