Stabilize const for integer {to,from}_{be,le,ne}_bytes methods

All of these functions can be implemented simply and naturally as
const functions, e.g. u32::from_le_bytes can be implemented as

    (bytes[0] as u32)
        | (bytes[1] as u32) << 8
        | (bytes[2] as u32) << 16
        | (bytes[3] as u32) << 24

So stabilizing the constness will not expose that internally they are
implemented using transmute which is not const in stable.
This commit is contained in:
Trevor Spiteri
2020-02-22 14:03:46 +01:00
parent 03d2f5cd6c
commit d15a98b878
3 changed files with 16 additions and 15 deletions

View File

@@ -131,7 +131,6 @@
#![feature(rtm_target_feature)]
#![feature(f16c_target_feature)]
#![feature(hexagon_target_feature)]
#![feature(const_int_conversion)]
#![feature(const_transmute)]
#![feature(structural_match)]
#![feature(abi_unadjusted)]