Move trait impls for primitives near trait definition

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.

Closes #12925