2021-11-04 11:57:40 -05:00
|
|
|
error[E0308]: mismatched types
|
2022-01-11 22:22:00 -06:00
|
|
|
--> $DIR/compatible-variants.rs:13:5
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | fn a() -> Option<()> {
|
|
|
|
| ---------- expected `Option<()>` because of return type
|
|
|
|
LL | / while false {
|
|
|
|
LL | |
|
|
|
|
LL | | f();
|
|
|
|
LL | | }
|
|
|
|
| |_____^ expected enum `Option`, found `()`
|
|
|
|
|
|
|
|
|
= note: expected enum `Option<()>`
|
|
|
|
found unit type `()`
|
|
|
|
help: try adding an expression at the end of the block
|
|
|
|
|
|
|
|
|
LL ~ }
|
|
|
|
LL + None
|
|
|
|
|
|
|
|
|
LL ~ }
|
|
|
|
LL + Some(())
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-01-11 22:22:00 -06:00
|
|
|
--> $DIR/compatible-variants.rs:21:5
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | fn b() -> Result<(), ()> {
|
|
|
|
| -------------- expected `Result<(), ()>` because of return type
|
|
|
|
LL | f()
|
|
|
|
| ^^^ expected enum `Result`, found `()`
|
|
|
|
|
|
|
|
|
= note: expected enum `Result<(), ()>`
|
|
|
|
found unit type `()`
|
|
|
|
help: try adding an expression at the end of the block
|
|
|
|
|
|
|
|
|
LL ~ f();
|
|
|
|
LL + Ok(())
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-01-19 06:11:48 -06:00
|
|
|
--> $DIR/compatible-variants.rs:27:5
|
|
|
|
|
|
|
|
|
LL | fn c() -> Option<()> {
|
|
|
|
| ---------- expected `Option<()>` because of return type
|
|
|
|
LL | / for _ in [1, 2] {
|
|
|
|
LL | |
|
|
|
|
LL | | f();
|
|
|
|
LL | | }
|
|
|
|
| |_____^ expected enum `Option`, found `()`
|
|
|
|
|
|
|
|
|
= note: expected enum `Option<()>`
|
|
|
|
found unit type `()`
|
|
|
|
help: try adding an expression at the end of the block
|
|
|
|
|
|
|
|
|
LL ~ }
|
|
|
|
LL + None
|
|
|
|
|
|
|
|
|
LL ~ }
|
|
|
|
LL + Some(())
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: `?` operator has incompatible types
|
|
|
|
--> $DIR/compatible-variants.rs:35:5
|
|
|
|
|
|
|
|
|
LL | c()?
|
|
|
|
| ^^^^ expected enum `Option`, found `()`
|
|
|
|
|
|
|
|
|
= note: `?` operator cannot convert from `()` to `Option<()>`
|
|
|
|
= note: expected enum `Option<()>`
|
|
|
|
found unit type `()`
|
|
|
|
help: try removing this `?`
|
|
|
|
|
|
|
|
|
LL - c()?
|
|
|
|
LL + c()
|
2022-06-08 12:34:57 -05:00
|
|
|
|
|
2022-01-19 06:11:48 -06:00
|
|
|
help: try adding an expression at the end of the block
|
|
|
|
|
|
|
|
|
LL ~ c()?;
|
|
|
|
LL + None
|
|
|
|
|
|
|
|
|
LL ~ c()?;
|
|
|
|
LL + Some(())
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/compatible-variants.rs:42:25
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | let _: Option<()> = while false {};
|
|
|
|
| ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
|
|
|
|
| |
|
|
|
|
| expected due to this
|
|
|
|
|
|
|
|
|
= note: expected enum `Option<()>`
|
|
|
|
found unit type `()`
|
|
|
|
help: try wrapping the expression in `Some`
|
|
|
|
|
|
|
|
|
LL | let _: Option<()> = Some(while false {});
|
|
|
|
| +++++ +
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-01-19 06:11:48 -06:00
|
|
|
--> $DIR/compatible-variants.rs:46:9
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | while false {}
|
|
|
|
| ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
|
|
|
|
|
|
|
|
|
= note: expected enum `Option<()>`
|
|
|
|
found unit type `()`
|
|
|
|
help: try adding an expression at the end of the block
|
|
|
|
|
|
|
|
|
LL ~ while false {}
|
|
|
|
LL + None
|
|
|
|
|
|
|
|
|
LL ~ while false {}
|
|
|
|
LL + Some(())
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-01-19 06:11:48 -06:00
|
|
|
--> $DIR/compatible-variants.rs:50:31
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | let _: Result<i32, i32> = 1;
|
|
|
|
| ---------------- ^ expected enum `Result`, found integer
|
|
|
|
| |
|
|
|
|
| expected due to this
|
|
|
|
|
|
|
|
|
= note: expected enum `Result<i32, i32>`
|
|
|
|
found type `{integer}`
|
|
|
|
help: try wrapping the expression in a variant of `Result`
|
|
|
|
|
|
|
|
|
LL | let _: Result<i32, i32> = Ok(1);
|
|
|
|
| +++ +
|
|
|
|
LL | let _: Result<i32, i32> = Err(1);
|
|
|
|
| ++++ +
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-01-19 06:11:48 -06:00
|
|
|
--> $DIR/compatible-variants.rs:53:26
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | let _: Option<i32> = 1;
|
|
|
|
| ----------- ^ expected enum `Option`, found integer
|
|
|
|
| |
|
|
|
|
| expected due to this
|
|
|
|
|
|
|
|
|
= note: expected enum `Option<i32>`
|
|
|
|
found type `{integer}`
|
|
|
|
help: try wrapping the expression in `Some`
|
|
|
|
|
|
|
|
|
LL | let _: Option<i32> = Some(1);
|
|
|
|
| +++++ +
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-01-19 06:11:48 -06:00
|
|
|
--> $DIR/compatible-variants.rs:56:28
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | let _: Hey<i32, i32> = 1;
|
|
|
|
| ------------- ^ expected enum `Hey`, found integer
|
|
|
|
| |
|
|
|
|
| expected due to this
|
|
|
|
|
|
|
|
|
= note: expected enum `Hey<i32, i32>`
|
|
|
|
found type `{integer}`
|
|
|
|
help: try wrapping the expression in a variant of `Hey`
|
|
|
|
|
|
|
|
|
LL | let _: Hey<i32, i32> = Hey::A(1);
|
|
|
|
| +++++++ +
|
|
|
|
LL | let _: Hey<i32, i32> = Hey::B(1);
|
|
|
|
| +++++++ +
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2022-01-19 06:11:48 -06:00
|
|
|
--> $DIR/compatible-variants.rs:59:29
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
|
LL | let _: Hey<i32, bool> = false;
|
|
|
|
| -------------- ^^^^^ expected enum `Hey`, found `bool`
|
|
|
|
| |
|
|
|
|
| expected due to this
|
|
|
|
|
|
|
|
|
= note: expected enum `Hey<i32, bool>`
|
|
|
|
found type `bool`
|
|
|
|
help: try wrapping the expression in `Hey::B`
|
|
|
|
|
|
|
|
|
LL | let _: Hey<i32, bool> = Hey::B(false);
|
|
|
|
| +++++++ +
|
|
|
|
|
2022-01-11 22:22:00 -06:00
|
|
|
error[E0308]: mismatched types
|
2022-01-19 06:11:48 -06:00
|
|
|
--> $DIR/compatible-variants.rs:63:19
|
2022-01-11 22:22:00 -06:00
|
|
|
|
|
|
|
|
LL | let _ = Foo { bar };
|
|
|
|
| ^^^ expected enum `Option`, found `i32`
|
|
|
|
|
|
|
|
|
= note: expected enum `Option<i32>`
|
|
|
|
found type `i32`
|
|
|
|
help: try wrapping the expression in `Some`
|
|
|
|
|
|
|
|
|
LL | let _ = Foo { bar: Some(bar) };
|
2022-01-13 16:03:56 -06:00
|
|
|
| ++++++++++ +
|
2022-01-11 22:22:00 -06:00
|
|
|
|
2022-03-27 18:05:14 -05:00
|
|
|
error[E0308]: mismatched types
|
2022-03-27 18:15:26 -05:00
|
|
|
--> $DIR/compatible-variants.rs:81:16
|
2022-03-27 18:05:14 -05:00
|
|
|
|
|
|
|
|
LL | let a: A = B::Fst;
|
|
|
|
| - ^^^^^^ expected enum `A`, found enum `B`
|
|
|
|
| |
|
|
|
|
| expected due to this
|
|
|
|
|
2022-03-27 18:15:26 -05:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/compatible-variants.rs:87:17
|
|
|
|
|
|
|
|
|
LL | let a: A2 = B::Fst;
|
|
|
|
| -- ^^^^^^ expected struct `A2`, found enum `B`
|
|
|
|
| |
|
|
|
|
| expected due to this
|
|
|
|
|
|
|
|
|
help: try wrapping the expression in `A2`
|
|
|
|
|
|
|
|
|
LL | let a: A2 = A2(B::Fst);
|
|
|
|
| +++ +
|
|
|
|
|
|
|
|
error: aborting due to 13 previous errors
|
2021-11-04 11:57:40 -05:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|