fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0308]: mismatched types 2 --> $DIR/compatible-variants.rs:13:5 3 | 4LL | fn a() -> Option<()> { 5 | ---------- expected `Option<()>` because of return type 6LL | / while false { 7LL | | 8LL | | f(); 9LL | | } 10 | |_____^ expected `Option<()>`, found `()` 11 | 12 = note: expected enum `Option<()>` 13 found unit type `()` 14help: try adding an expression at the end of the block 15 | 16LL ~ } 17LL + None 18 | 19LL ~ } 20LL + Some(()) 21 | 22 23error[E0308]: mismatched types 24 --> $DIR/compatible-variants.rs:21:5 25 | 26LL | fn b() -> Result<(), ()> { 27 | -------------- expected `Result<(), ()>` because of return type 28LL | f() 29 | ^^^ expected `Result<(), ()>`, found `()` 30 | 31 = note: expected enum `Result<(), ()>` 32 found unit type `()` 33help: try adding an expression at the end of the block 34 | 35LL ~ f(); 36LL + Ok(()) 37 | 38 39error[E0308]: mismatched types 40 --> $DIR/compatible-variants.rs:27:5 41 | 42LL | fn c() -> Option<()> { 43 | ---------- expected `Option<()>` because of return type 44LL | / for _ in [1, 2] { 45LL | | 46LL | | f(); 47LL | | } 48 | |_____^ expected `Option<()>`, found `()` 49 | 50 = note: expected enum `Option<()>` 51 found unit type `()` 52help: try adding an expression at the end of the block 53 | 54LL ~ } 55LL + None 56 | 57LL ~ } 58LL + Some(()) 59 | 60 61error[E0308]: `?` operator has incompatible types 62 --> $DIR/compatible-variants.rs:35:5 63 | 64LL | fn d() -> Option<()> { 65 | ---------- expected `Option<()>` because of return type 66LL | c()? 67 | ^^^^ expected `Option<()>`, found `()` 68 | 69 = note: `?` operator cannot convert from `()` to `Option<()>` 70 = note: expected enum `Option<()>` 71 found unit type `()` 72help: try removing this `?` 73 | 74LL - c()? 75LL + c() 76 | 77help: try adding an expression at the end of the block 78 | 79LL ~ c()?; 80LL + None 81 | 82LL ~ c()?; 83LL + Some(()) 84 | 85 86error[E0308]: mismatched types 87 --> $DIR/compatible-variants.rs:42:25 88 | 89LL | let _: Option<()> = while false {}; 90 | ---------- ^^^^^^^^^^^^^^ expected `Option<()>`, found `()` 91 | | 92 | expected due to this 93 | 94 = note: expected enum `Option<()>` 95 found unit type `()` 96help: try wrapping the expression in `Some` 97 | 98LL | let _: Option<()> = Some(while false {}); 99 | +++++ + 100 101error[E0308]: mismatched types 102 --> $DIR/compatible-variants.rs:46:9 103 | 104LL | while false {} 105 | ^^^^^^^^^^^^^^ expected `Option<()>`, found `()` 106 | 107 = note: expected enum `Option<()>` 108 found unit type `()` 109help: try adding an expression at the end of the block 110 | 111LL ~ while false {} 112LL + None 113 | 114LL ~ while false {} 115LL + Some(()) 116 | 117 118error[E0308]: mismatched types 119 --> $DIR/compatible-variants.rs:50:31 120 | 121LL | let _: Result<i32, i32> = 1; 122 | ---------------- ^ expected `Result<i32, i32>`, found integer 123 | | 124 | expected due to this 125 | 126 = note: expected enum `Result<i32, i32>` 127 found type `{integer}` 128help: try wrapping the expression in a variant of `Result` 129 | 130LL | let _: Result<i32, i32> = Ok(1); 131 | +++ + 132LL | let _: Result<i32, i32> = Err(1); 133 | ++++ + 134 135error[E0308]: mismatched types 136 --> $DIR/compatible-variants.rs:53:26 137 | 138LL | let _: Option<i32> = 1; 139 | ----------- ^ expected `Option<i32>`, found integer 140 | | 141 | expected due to this 142 | 143 = note: expected enum `Option<i32>` 144 found type `{integer}` 145help: try wrapping the expression in `Some` 146 | 147LL | let _: Option<i32> = Some(1); 148 | +++++ + 149 150error[E0308]: mismatched types 151 --> $DIR/compatible-variants.rs:56:28 152 | 153LL | let _: Hey<i32, i32> = 1; 154 | ------------- ^ expected `Hey<i32, i32>`, found integer 155 | | 156 | expected due to this 157 | 158 = note: expected enum `Hey<i32, i32>` 159 found type `{integer}` 160help: try wrapping the expression in a variant of `Hey` 161 | 162LL | let _: Hey<i32, i32> = Hey::A(1); 163 | +++++++ + 164LL | let _: Hey<i32, i32> = Hey::B(1); 165 | +++++++ + 166 167error[E0308]: mismatched types 168 --> $DIR/compatible-variants.rs:59:29 169 | 170LL | let _: Hey<i32, bool> = false; 171 | -------------- ^^^^^ expected `Hey<i32, bool>`, found `bool` 172 | | 173 | expected due to this 174 | 175 = note: expected enum `Hey<i32, bool>` 176 found type `bool` 177help: try wrapping the expression in `Hey::B` 178 | 179LL | let _: Hey<i32, bool> = Hey::B(false); 180 | +++++++ + 181 182error[E0308]: mismatched types 183 --> $DIR/compatible-variants.rs:63:19 184 | 185LL | let _ = Foo { bar }; 186 | ^^^ expected `Option<i32>`, found `i32` 187 | 188 = note: expected enum `Option<i32>` 189 found type `i32` 190help: try wrapping the expression in `Some` 191 | 192LL | let _ = Foo { bar: Some(bar) }; 193 | ++++++++++ + 194 195error[E0308]: mismatched types 196 --> $DIR/compatible-variants.rs:80:16 197 | 198LL | let a: A = B::Fst; 199 | - ^^^^^^ expected `A`, found `B` 200 | | 201 | expected due to this 202 | 203help: try wrapping the expression in `A::B` 204 | 205LL | let a: A = A::B { b: B::Fst }; 206 | +++++++++ + 207 208error[E0308]: mismatched types 209 --> $DIR/compatible-variants.rs:86:17 210 | 211LL | let a: A2 = B::Fst; 212 | -- ^^^^^^ expected `A2`, found `B` 213 | | 214 | expected due to this 215 | 216help: try wrapping the expression in `A2` 217 | 218LL | let a: A2 = A2(B::Fst); 219 | +++ + 220 221error: aborting due to 13 previous errors 222 223For more information about this error, try `rustc --explain E0308`.