|
| 1 | +error[E0308]: mismatched types |
| 2 | + --> $DIR/suggest-box-for-expr-field-issue-139631.rs:11:18 |
| 3 | + | |
| 4 | +LL | let v2 = X { a }; |
| 5 | + | ^ expected `Box<u32>`, found integer |
| 6 | + | |
| 7 | + = note: expected struct `Box<u32>` |
| 8 | + found type `{integer}` |
| 9 | + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html |
| 10 | +help: store this in the heap by calling `Box::new` |
| 11 | + | |
| 12 | +LL | let v2 = X { Box::new(a) }; |
| 13 | + | +++++++++ + |
| 14 | + |
| 15 | +error[E0308]: mismatched types |
| 16 | + --> $DIR/suggest-box-for-expr-field-issue-139631.rs:12:21 |
| 17 | + | |
| 18 | +LL | let v3 = Y { y: a }; |
| 19 | + | ^ expected `Box<u32>`, found integer |
| 20 | + | |
| 21 | + = note: expected struct `Box<u32>` |
| 22 | + found type `{integer}` |
| 23 | + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html |
| 24 | +help: store this in the heap by calling `Box::new` |
| 25 | + | |
| 26 | +LL | let v3 = Y { y: Box::new(a) }; |
| 27 | + | +++++++++ + |
| 28 | + |
| 29 | +error[E0560]: struct `Y` has no field named `a` |
| 30 | + --> $DIR/suggest-box-for-expr-field-issue-139631.rs:13:18 |
| 31 | + | |
| 32 | +LL | let v4 = Y { a }; |
| 33 | + | ^ unknown field |
| 34 | + | |
| 35 | +help: a field with a similar name exists |
| 36 | + | |
| 37 | +LL - let v4 = Y { a }; |
| 38 | +LL + let v4 = Y { y }; |
| 39 | + | |
| 40 | + |
| 41 | +error: aborting due to 3 previous errors |
| 42 | + |
| 43 | +Some errors have detailed explanations: E0308, E0560. |
| 44 | +For more information about an error, try `rustc --explain E0308`. |
0 commit comments