rust/tests/ui/mismatched_types/mismatch-ty-unwrap-expect.s...

94 lines
3.1 KiB
Plaintext

error[E0308]: mismatched types
--> $DIR/mismatch-ty-unwrap-expect.rs:10:18
|
LL | let v: i32 = b;
| --- ^ expected `i32`, found `Result<i32, ()>`
| |
| expected due to this
|
= note: expected type `i32`
found enum `Result<i32, ()>`
help: use the `?` operator to extract the `Result<i32, ()>` value, propagating a `Result::Err` value to the caller
|
LL | let v: i32 = b?;
| +
error[E0308]: mismatched types
--> $DIR/mismatch-ty-unwrap-expect.rs:16:18
|
LL | let v: i32 = b;
| --- ^ expected `i32`, found `Option<{integer}>`
| |
| expected due to this
|
= note: expected type `i32`
found enum `Option<{integer}>`
help: use the `?` operator to extract the `Option<{integer}>` value, propagating an `Option::None` value to the caller
|
LL | let v: i32 = b?;
| +
error[E0308]: mismatched types
--> $DIR/mismatch-ty-unwrap-expect.rs:22:18
|
LL | let v: i32 = a;
| --- ^ expected `i32`, found `Option<{integer}>`
| |
| expected due to this
|
= note: expected type `i32`
found enum `Option<{integer}>`
help: consider using `Option::expect` to unwrap the `Option<{integer}>` value, panicking if the value is an `Option::None`
|
LL | let v: i32 = a.expect("REASON");
| +++++++++++++++++
error[E0308]: mismatched types
--> $DIR/mismatch-ty-unwrap-expect.rs:25:18
|
LL | let v: i32 = b;
| --- ^ expected `i32`, found `Result<i32, ()>`
| |
| expected due to this
|
= note: expected type `i32`
found enum `Result<i32, ()>`
help: consider using `Result::expect` to unwrap the `Result<i32, ()>` value, panicking if the value is a `Result::Err`
|
LL | let v: i32 = b.expect("REASON");
| +++++++++++++++++
error[E0308]: mismatched types
--> $DIR/mismatch-ty-unwrap-expect.rs:27:18
|
LL | let v: i32 = func();
| --- ^^^^^^ expected `i32`, found `Option<i32>`
| |
| expected due to this
|
= note: expected type `i32`
found enum `Option<i32>`
help: consider using `Option::expect` to unwrap the `Option<i32>` value, panicking if the value is an `Option::None`
|
LL | let v: i32 = func().expect("REASON");
| +++++++++++++++++
error[E0308]: mismatched types
--> $DIR/mismatch-ty-unwrap-expect.rs:30:18
|
LL | let v: i32 = a;
| --- ^ expected `i32`, found `Option<_>`
| |
| expected due to this
|
= note: expected type `i32`
found enum `Option<_>`
help: consider using `Option::expect` to unwrap the `Option<_>` value, panicking if the value is an `Option::None`
|
LL | let v: i32 = a.expect("REASON");
| +++++++++++++++++
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0308`.