1 error[E0308]: mismatched types
2 --> $DIR/compatible-variants.rs:13:5
4 LL | fn a() -> Option<()> {
5 | ---------- expected `Option<()>` because of return type
10 | |_____^ expected enum `Option`, found `()`
12 = note: expected enum `Option<()>`
14 help: try adding an expression at the end of the block
23 error[E0308]: mismatched types
24 --> $DIR/compatible-variants.rs:21:5
26 LL | fn b() -> Result<(), ()> {
27 | -------------- expected `Result<(), ()>` because of return type
29 | ^^^ expected enum `Result`, found `()`
31 = note: expected enum `Result<(), ()>`
33 help: try adding an expression at the end of the block
39 error[E0308]: mismatched types
40 --> $DIR/compatible-variants.rs:27:25
42 LL | let _: Option<()> = while false {};
43 | ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
45 | expected due to this
47 = note: expected enum `Option<()>`
49 help: try wrapping the expression in `Some`
51 LL | let _: Option<()> = Some(while false {});
54 error[E0308]: mismatched types
55 --> $DIR/compatible-variants.rs:31:9
58 | ^^^^^^^^^^^^^^ expected enum `Option`, found `()`
60 = note: expected enum `Option<()>`
62 help: try adding an expression at the end of the block
71 error[E0308]: mismatched types
72 --> $DIR/compatible-variants.rs:35:31
74 LL | let _: Result<i32, i32> = 1;
75 | ---------------- ^ expected enum `Result`, found integer
77 | expected due to this
79 = note: expected enum `Result<i32, i32>`
80 found type `{integer}`
81 help: try wrapping the expression in a variant of `Result`
83 LL | let _: Result<i32, i32> = Ok(1);
85 LL | let _: Result<i32, i32> = Err(1);
88 error[E0308]: mismatched types
89 --> $DIR/compatible-variants.rs:38:26
91 LL | let _: Option<i32> = 1;
92 | ----------- ^ expected enum `Option`, found integer
94 | expected due to this
96 = note: expected enum `Option<i32>`
97 found type `{integer}`
98 help: try wrapping the expression in `Some`
100 LL | let _: Option<i32> = Some(1);
103 error[E0308]: mismatched types
104 --> $DIR/compatible-variants.rs:41:28
106 LL | let _: Hey<i32, i32> = 1;
107 | ------------- ^ expected enum `Hey`, found integer
109 | expected due to this
111 = note: expected enum `Hey<i32, i32>`
112 found type `{integer}`
113 help: try wrapping the expression in a variant of `Hey`
115 LL | let _: Hey<i32, i32> = Hey::A(1);
117 LL | let _: Hey<i32, i32> = Hey::B(1);
120 error[E0308]: mismatched types
121 --> $DIR/compatible-variants.rs:44:29
123 LL | let _: Hey<i32, bool> = false;
124 | -------------- ^^^^^ expected enum `Hey`, found `bool`
126 | expected due to this
128 = note: expected enum `Hey<i32, bool>`
130 help: try wrapping the expression in `Hey::B`
132 LL | let _: Hey<i32, bool> = Hey::B(false);
135 error[E0308]: mismatched types
136 --> $DIR/compatible-variants.rs:48:19
138 LL | let _ = Foo { bar };
139 | ^^^ expected enum `Option`, found `i32`
141 = note: expected enum `Option<i32>`
143 help: try wrapping the expression in `Some`
145 LL | let _ = Foo { bar: Some(bar) };
148 error: aborting due to 9 previous errors
150 For more information about this error, try `rustc --explain E0308`.