Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- struct S; impl std::cmp::PartialEq<S> for usize { fn eq(self, _: usize) -> Option<bool> { Some(true) } } S == 5_usize
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0053]: method `eq` has an incompatible type for trait
- --> src/main.rs:6:59
- |
- 6 | struct S; impl std::cmp::PartialEq<S> for usize { fn eq(self, _: usize) -> Option<bool> { Some(true) } } S == 5_usize
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &usize, found usize
- |
- = note: expected type `fn(&usize, &main::S) -> bool`
- found type `fn(usize, usize) -> std::option::Option<bool>`
- error[E0369]: binary operation `==` cannot be applied to type `main::S`
- --> src/main.rs:6:116
- |
- 6 | struct S; impl std::cmp::PartialEq<S> for usize { fn eq(self, _: usize) -> Option<bool> { Some(true) } } S == 5_usize
- | - ^^ ------- usize
- | |
- | main::S
- |
- = note: an implementation of `std::cmp::PartialEq` might be missing for `main::S`
- error: aborting due to 2 previous errors
- Some errors have detailed explanations: E0053, E0369.
- For more information about an error, try `rustc --explain E0053`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement