Closed
Description
pub struct Struct<K: 'static> {
pub field: K,
}
static STRUCT: Struct<&'static [u8]> = Struct {
field: &[1]
};
pub struct Tuple<K: 'static>(K);
static TUPLE: Tuple<&'static [u8]> = Tuple(&[1]);
STRUCT
fails to type check, while TUPLE
succeeds.
<anon>:7:40: 9:2 error: mismatched types:
expected `Struct<&'static [u8]>`,
found `Struct<&[_; 1]>`
(expected slice,
found array of 1 elements) [E0308]
<anon>:7 static STRUCT: Struct<&'static [u8]> = Struct {
<anon>:8 field: &[1]
<anon>:9 };
<anon>:7:40: 9:2 help: see the detailed explanation for E0308