|
| 1 | +error[E0308]: mismatched types |
| 2 | + --> $DIR/compatible-variants.rs:9:5 |
| 3 | + | |
| 4 | +LL | fn a() -> Option<()> { |
| 5 | + | ---------- expected `Option<()>` because of return type |
| 6 | +LL | / while false { |
| 7 | +LL | | |
| 8 | +LL | | f(); |
| 9 | +LL | | } |
| 10 | + | |_____^ expected enum `Option`, found `()` |
| 11 | + | |
| 12 | + = note: expected enum `Option<()>` |
| 13 | + found unit type `()` |
| 14 | +help: try adding an expression at the end of the block |
| 15 | + | |
| 16 | +LL ~ } |
| 17 | +LL + None |
| 18 | + | |
| 19 | +LL ~ } |
| 20 | +LL + Some(()) |
| 21 | + | |
| 22 | + |
| 23 | +error[E0308]: mismatched types |
| 24 | + --> $DIR/compatible-variants.rs:17:5 |
| 25 | + | |
| 26 | +LL | fn b() -> Result<(), ()> { |
| 27 | + | -------------- expected `Result<(), ()>` because of return type |
| 28 | +LL | f() |
| 29 | + | ^^^ expected enum `Result`, found `()` |
| 30 | + | |
| 31 | + = note: expected enum `Result<(), ()>` |
| 32 | + found unit type `()` |
| 33 | +help: try adding an expression at the end of the block |
| 34 | + | |
| 35 | +LL ~ f(); |
| 36 | +LL + Ok(()) |
| 37 | + | |
| 38 | + |
| 39 | +error[E0308]: mismatched types |
| 40 | + --> $DIR/compatible-variants.rs:23:25 |
| 41 | + | |
| 42 | +LL | let _: Option<()> = while false {}; |
| 43 | + | ---------- ^^^^^^^^^^^^^^ expected enum `Option`, found `()` |
| 44 | + | | |
| 45 | + | expected due to this |
| 46 | + | |
| 47 | + = note: expected enum `Option<()>` |
| 48 | + found unit type `()` |
| 49 | +help: try wrapping the expression in `Some` |
| 50 | + | |
| 51 | +LL | let _: Option<()> = Some(while false {}); |
| 52 | + | +++++ + |
| 53 | + |
| 54 | +error[E0308]: mismatched types |
| 55 | + --> $DIR/compatible-variants.rs:27:9 |
| 56 | + | |
| 57 | +LL | while false {} |
| 58 | + | ^^^^^^^^^^^^^^ expected enum `Option`, found `()` |
| 59 | + | |
| 60 | + = note: expected enum `Option<()>` |
| 61 | + found unit type `()` |
| 62 | +help: try adding an expression at the end of the block |
| 63 | + | |
| 64 | +LL ~ while false {} |
| 65 | +LL + None |
| 66 | + | |
| 67 | +LL ~ while false {} |
| 68 | +LL + Some(()) |
| 69 | + | |
| 70 | + |
| 71 | +error[E0308]: mismatched types |
| 72 | + --> $DIR/compatible-variants.rs:31:31 |
| 73 | + | |
| 74 | +LL | let _: Result<i32, i32> = 1; |
| 75 | + | ---------------- ^ expected enum `Result`, found integer |
| 76 | + | | |
| 77 | + | expected due to this |
| 78 | + | |
| 79 | + = note: expected enum `Result<i32, i32>` |
| 80 | + found type `{integer}` |
| 81 | +help: try wrapping the expression in a variant of `Result` |
| 82 | + | |
| 83 | +LL | let _: Result<i32, i32> = Ok(1); |
| 84 | + | +++ + |
| 85 | +LL | let _: Result<i32, i32> = Err(1); |
| 86 | + | ++++ + |
| 87 | + |
| 88 | +error[E0308]: mismatched types |
| 89 | + --> $DIR/compatible-variants.rs:34:26 |
| 90 | + | |
| 91 | +LL | let _: Option<i32> = 1; |
| 92 | + | ----------- ^ expected enum `Option`, found integer |
| 93 | + | | |
| 94 | + | expected due to this |
| 95 | + | |
| 96 | + = note: expected enum `Option<i32>` |
| 97 | + found type `{integer}` |
| 98 | +help: try wrapping the expression in `Some` |
| 99 | + | |
| 100 | +LL | let _: Option<i32> = Some(1); |
| 101 | + | +++++ + |
| 102 | + |
| 103 | +error[E0308]: mismatched types |
| 104 | + --> $DIR/compatible-variants.rs:37:28 |
| 105 | + | |
| 106 | +LL | let _: Hey<i32, i32> = 1; |
| 107 | + | ------------- ^ expected enum `Hey`, found integer |
| 108 | + | | |
| 109 | + | expected due to this |
| 110 | + | |
| 111 | + = note: expected enum `Hey<i32, i32>` |
| 112 | + found type `{integer}` |
| 113 | +help: try wrapping the expression in a variant of `Hey` |
| 114 | + | |
| 115 | +LL | let _: Hey<i32, i32> = Hey::A(1); |
| 116 | + | +++++++ + |
| 117 | +LL | let _: Hey<i32, i32> = Hey::B(1); |
| 118 | + | +++++++ + |
| 119 | + |
| 120 | +error[E0308]: mismatched types |
| 121 | + --> $DIR/compatible-variants.rs:40:29 |
| 122 | + | |
| 123 | +LL | let _: Hey<i32, bool> = false; |
| 124 | + | -------------- ^^^^^ expected enum `Hey`, found `bool` |
| 125 | + | | |
| 126 | + | expected due to this |
| 127 | + | |
| 128 | + = note: expected enum `Hey<i32, bool>` |
| 129 | + found type `bool` |
| 130 | +help: try wrapping the expression in `Hey::B` |
| 131 | + | |
| 132 | +LL | let _: Hey<i32, bool> = Hey::B(false); |
| 133 | + | +++++++ + |
| 134 | + |
| 135 | +error: aborting due to 8 previous errors |
| 136 | + |
| 137 | +For more information about this error, try `rustc --explain E0308`. |
0 commit comments