|
| 1 | +error[E0308]: mismatched types |
| 2 | + --> $DIR/arrays-and-slices.rs:18:9 |
| 3 | + | |
| 4 | +LL | const BSTR_SIZED: &'static [u8; 3] = b"012"; |
| 5 | + | ---------------------------------- constant defined here |
| 6 | +... |
| 7 | +LL | match BSTR_UNSIZED { |
| 8 | + | ------------ this expression has type `&[u8]` |
| 9 | +LL | BSTR_SIZED => {} |
| 10 | + | ^^^^^^^^^^ |
| 11 | + | | |
| 12 | + | expected `&[u8]`, found `&[u8; 3]` |
| 13 | + | `BSTR_SIZED` is interpreted as a constant, not a new binding |
| 14 | + | help: introduce a new binding instead: `other_bstr_sized` |
| 15 | + | |
| 16 | + = note: expected reference `&[u8]` |
| 17 | + found reference `&'static [u8; 3]` |
| 18 | + |
| 19 | +error[E0308]: mismatched types |
| 20 | + --> $DIR/arrays-and-slices.rs:23:9 |
| 21 | + | |
| 22 | +LL | const STRUCT_SIZED: &'static SomeStruct<[u8; 3]> = &SomeStruct(*BSTR_SIZED); |
| 23 | + | ------------------------------------------------ constant defined here |
| 24 | +... |
| 25 | +LL | match STRUCT_UNSIZED { |
| 26 | + | -------------- this expression has type `&SomeStruct<[u8]>` |
| 27 | +LL | STRUCT_SIZED => {} |
| 28 | + | ^^^^^^^^^^^^ |
| 29 | + | | |
| 30 | + | expected `&SomeStruct<[u8]>`, found `&SomeStruct<[u8; 3]>` |
| 31 | + | `STRUCT_SIZED` is interpreted as a constant, not a new binding |
| 32 | + | help: introduce a new binding instead: `other_struct_sized` |
| 33 | + | |
| 34 | + = note: expected reference `&SomeStruct<[u8]>` |
| 35 | + found reference `&'static SomeStruct<[u8; 3]>` |
| 36 | + |
| 37 | +error[E0308]: mismatched types |
| 38 | + --> $DIR/arrays-and-slices.rs:30:9 |
| 39 | + | |
| 40 | +LL | const BSTR_SIZED: &'static [u8; 3] = b"012"; |
| 41 | + | ---------------------------------- constant defined here |
| 42 | +... |
| 43 | +LL | match BSTR_UNSIZED { |
| 44 | + | ------------ this expression has type `&[u8]` |
| 45 | +LL | BSTR_SIZED => {} |
| 46 | + | ^^^^^^^^^^ |
| 47 | + | | |
| 48 | + | expected `&[u8]`, found `&[u8; 3]` |
| 49 | + | `BSTR_SIZED` is interpreted as a constant, not a new binding |
| 50 | + | help: introduce a new binding instead: `other_bstr_sized` |
| 51 | + | |
| 52 | + = note: expected reference `&[u8]` |
| 53 | + found reference `&'static [u8; 3]` |
| 54 | + |
| 55 | +error[E0308]: mismatched types |
| 56 | + --> $DIR/arrays-and-slices.rs:37:9 |
| 57 | + | |
| 58 | +LL | const STRUCT_SIZED: &'static SomeStruct<[u8; 3]> = &SomeStruct(*BSTR_SIZED); |
| 59 | + | ------------------------------------------------ constant defined here |
| 60 | +... |
| 61 | +LL | match STRUCT_UNSIZED { |
| 62 | + | -------------- this expression has type `&SomeStruct<[u8]>` |
| 63 | +LL | STRUCT_SIZED => {} |
| 64 | + | ^^^^^^^^^^^^ |
| 65 | + | | |
| 66 | + | expected `&SomeStruct<[u8]>`, found `&SomeStruct<[u8; 3]>` |
| 67 | + | `STRUCT_SIZED` is interpreted as a constant, not a new binding |
| 68 | + | help: introduce a new binding instead: `other_struct_sized` |
| 69 | + | |
| 70 | + = note: expected reference `&SomeStruct<[u8]>` |
| 71 | + found reference `&'static SomeStruct<[u8; 3]>` |
| 72 | + |
| 73 | +error: cannot use unsized non-slice type `SomeStruct<[u8]>` in constant patterns |
| 74 | + --> $DIR/arrays-and-slices.rs:47:9 |
| 75 | + | |
| 76 | +LL | const STRUCT_UNSIZED: &'static SomeStruct<[u8]> = STRUCT_SIZED; |
| 77 | + | ----------------------------------------------- constant defined here |
| 78 | +... |
| 79 | +LL | STRUCT_UNSIZED => {} |
| 80 | + | ^^^^^^^^^^^^^^ |
| 81 | + |
| 82 | +error: aborting due to 5 previous errors |
| 83 | + |
| 84 | +For more information about this error, try `rustc --explain E0308`. |
0 commit comments