let n: usize = 42;
this_function_expects_a_double_option(n);
//~^ ERROR mismatched types
- //~| HELP try using a variant of the expected enum
+ //~| HELP try wrapping the expression in a variant of `DoubleOption`
}
|
= note: expected enum `DoubleOption<_>`
found type `usize`
-help: try using a variant of the expected enum
+help: try wrapping the expression in a variant of `DoubleOption`
|
-LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n));
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | ++++++++++++++++++++++++ +
+LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n));
+ | ++++++++++++++++++++++++++++++ +
error[E0308]: mismatched types
--> $DIR/issue-42764.rs:27:33
--> $DIR/fully-qualified-type-name1.rs:5:9
|
LL | x = 5;
- | ^
- | |
- | expected enum `Option`, found integer
- | help: try using a variant of the expected enum: `Some(5)`
+ | ^ expected enum `Option`, found integer
|
= note: expected enum `Option<usize>`
found type `{integer}`
+help: try wrapping the expression in `Some`
+ |
+LL | x = Some(5);
+ | +++++ +
error: aborting due to previous error
LL | fn bar(x: usize) -> Option<usize> {
| ------------- expected `Option<usize>` because of return type
LL | return x;
- | ^
- | |
- | expected enum `Option`, found `usize`
- | help: try using a variant of the expected enum: `Some(x)`
+ | ^ expected enum `Option`, found `usize`
|
= note: expected enum `Option<usize>`
found type `usize`
+help: try wrapping the expression in `Some`
+ |
+LL | return Some(x);
+ | +++++ +
error: aborting due to previous error
LL - missing_discourses()?
LL + missing_discourses()
|
-help: try using a variant of the expected enum
+help: try wrapping the expression in `Ok`
|
LL | Ok(missing_discourses()?)
- |
+ | +++ +
error: aborting due to previous error
LL | fn b() -> Option<Foo> {
| ----------- expected `Option<Foo>` because of return type
LL | Foo { bar: 1 }
- | ^^^^^^^^^^^^^^
- | |
- | expected enum `Option`, found struct `Foo`
- | help: try using a variant of the expected enum: `Some(Foo { bar: 1 })`
+ | ^^^^^^^^^^^^^^ expected enum `Option`, found struct `Foo`
|
= note: expected enum `Option<Foo>`
found struct `Foo`
+help: try wrapping the expression in `Some`
+ |
+LL | Some(Foo { bar: 1 })
+ | +++++ +
error[E0308]: mismatched types
--> $DIR/abridged.rs:28:5
LL | fn c() -> Result<Foo, Bar> {
| ---------------- expected `Result<Foo, Bar>` because of return type
LL | Foo { bar: 1 }
- | ^^^^^^^^^^^^^^
- | |
- | expected enum `Result`, found struct `Foo`
- | help: try using a variant of the expected enum: `Ok(Foo { bar: 1 })`
+ | ^^^^^^^^^^^^^^ expected enum `Result`, found struct `Foo`
|
= note: expected enum `Result<Foo, Bar>`
found struct `Foo`
+help: try wrapping the expression in `Ok`
+ |
+LL | Ok(Foo { bar: 1 })
+ | +++ +
error[E0308]: mismatched types
--> $DIR/abridged.rs:39:5
--> $DIR/pat-type-err-let-stmt.rs:6:29
|
LL | let Ok(0): Option<u8> = 42u8;
- | ---------- ^^^^
- | | |
- | | expected enum `Option`, found `u8`
- | | help: try using a variant of the expected enum: `Some(42u8)`
+ | ---------- ^^^^ expected enum `Option`, found `u8`
+ | |
| expected due to this
|
= note: expected enum `Option<u8>`
found type `u8`
+help: try wrapping the expression in `Some`
+ |
+LL | let Ok(0): Option<u8> = Some(42u8);
+ | +++++ +
error[E0308]: mismatched types
--> $DIR/pat-type-err-let-stmt.rs:6:9
--> $DIR/suggest-full-enum-variant-for-local-module.rs:9:28
|
LL | let _: option::O<()> = ();
- | ------------- ^^
- | | |
- | | expected enum `O`, found `()`
- | | help: try using a variant of the expected enum: `option::O::Some(())`
+ | ------------- ^^ expected enum `O`, found `()`
+ | |
| expected due to this
|
= note: expected enum `O<()>`
found unit type `()`
+help: try wrapping the expression in `option::O::Some`
+ |
+LL | let _: option::O<()> = option::O::Some(());
+ | ++++++++++++++++ +
error: aborting due to previous error
--> $DIR/issue-46112.rs:9:21
|
LL | fn main() { test(Ok(())); }
- | ^^
- | |
- | expected enum `Option`, found `()`
- | help: try using a variant of the expected enum: `Some(())`
+ | ^^ expected enum `Option`, found `()`
|
= note: expected enum `Option<()>`
found unit type `()`
+help: try wrapping the expression in `Some`
+ |
+LL | fn main() { test(Ok(Some(()))); }
+ | +++++ +
error: aborting due to previous error