fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
443 B25 linesraw
1// run-rustfix
2
3pub struct Bytes;
4
5impl Bytes {
6    pub fn as_slice(&self) -> &[u8] {
7        todo!()
8    }
9}
10
11impl PartialEq<[u8]> for Bytes {
12    fn eq(&self, other: &[u8]) -> bool {
13        self.as_slice() == other
14    }
15}
16
17impl PartialEq<Bytes> for &[u8] {
18    fn eq(&self, other: &Bytes) -> bool {
19        *other == **self
20    }
21}
22
23fn main() {
24    let _ = &[0u8] == &[0xAA][..]; //~ ERROR can't compare `&[u8; 1]` with `[{integer}; 1]`
25}