Closed
Description
Given the following code:
let buf = BufReader::new(&[0xff as u8, 0xff, 0x00, 0x1d, 0x01, 0x04, 0xff, 0xff, 0xff]);
The current output is:
let buf = BufReader::new(&[0xff as u8, 0xff, 0x00, 0x1d, 0x01, 0x04, 0xff, 0xff, 0xff]);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::io::Read` is not implemented for `&[u8; 9]`
Following a discussion with the Rust community on Discord, ideally the output should be adapted:
This looks like a missed unsizing coercion. Read is implemented for &[u8], but not for &[u8; 9]: you have a reference to an array, not to a slice. Try &[/your bytes here/][..]. –– T-Dark
actually a possible improvements for error message tbh –– ruff
array & slice is kinda similar in syntax –– ruff
https://discord.com/channels/273534239310479360/274215136414400513/905455195910205480
https://discord.com/channels/273534239310479360/274215136414400513/905455866029936641