Skip to content

Commit

Permalink
Rollup merge of rust-lang#58628 - RReverser:optimise-vec-false, r=oli…
Browse files Browse the repository at this point in the history
…-obk

Optimise vec![false; N] to zero-alloc

Nowadays booleans have a well-defined representation, so there is no reason not to optimise their allocation.
  • Loading branch information
Centril committed Feb 23, 2019
2 parents 8829866 + 9f58c5f commit 2841c45
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,7 @@ impl_is_zero!(u64, |x| x == 0);
impl_is_zero!(u128, |x| x == 0);
impl_is_zero!(usize, |x| x == 0);

impl_is_zero!(bool, |x| x == false);
impl_is_zero!(char, |x| x == '\0');

impl_is_zero!(f32, |x: f32| x.to_bits() == 0);
Expand Down

0 comments on commit 2841c45

Please sign in to comment.