Last active
August 29, 2015 14:08
-
-
Save japaric/7e11d7dc1932b25932b5 to your computer and use it in GitHub Desktop.
On top of Operator dispatch PR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let s: &[u8] = &[0u8, 1]; | |
s == s; // OK | |
s == [0, 1]; // OK | |
[0, 1] == s; | |
//^~ error: mismatched types: expected `[_]`, found `&[u8]` (expected slice, found &-ptr) | |
[0u8, 1] == [0u8, 1]; | |
//^~ error: error: mismatched types: expected `[u8]`, found `[u8, ..2]` (expected slice, found array of 2 elements) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let s: &[u8] = &[0u8, 1]; | |
s == s; // OK | |
s == [0, 1]; // OK | |
[0, 1] == s; | |
//^~ error: mismatched types: expected `[_, ..2]`, found `&[u8]` (expected array of 2 elements, found &-ptr) | |
[0u8, 1] == [0, 1]; // OK (This works because of your `impl PartialEq for [T, ..2]`) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment