-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Move trait impls for primitives near trait definition #14464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
) | ||
|
||
#[cfg(not(test))] shr_impl!(uint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #[cfg(not(test))]
annotations may be better placed on the impl itself (inside the macro)
I think I do like how this has turned out, thank you for tackling this! |
Thanks for comments, I forgot how awesome Rust's macros are! |
)*) | ||
) | ||
|
||
totaleq_impl!(() bool char uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we specifically don't implement TotalEq
for f32
and f64
, the rest are fine though.
Of course, I'm just really good at making stupid mistakes in code. |
This is an attempt of fixing #12925. This PR moves almost all trait implementations for primitive types ((), bool, char, i*, u*, f*) near trait definitions. Only Float trait implementations weren't moved because they heavily rely on constants defined in f32.rs and f64.rs. Some trait implementations had cfg(not(test)) attribute. I suspect it's because of issue 2912. Still, someone who knows the problem better should probably check this code. Closes #12925
lower adjusts in simple index except the last one fix rust-lang#14463
This is an attempt of fixing #12925.
This PR moves almost all trait implementations for primitive types ((), bool, char, i_, u_, f*) near trait definitions. Only Float trait implementations weren't moved because they heavily rely on constants defined in f32.rs and f64.rs.
Some trait implementations had cfg(not(test)) attribute. I suspect it's because of issue 2912.
Still, someone who knows the problem better should probably check this code.
Closes #12925