next_power_of_two: add a doctest to show what happens on 0

This commit is contained in:
Ralf Jung 2024-05-07 10:48:04 +02:00
parent d71b3f486a
commit 776f182241

View File

@ -2764,6 +2764,7 @@ const fn one_less_than_next_power_of_two(self) -> Self {
/// ```
#[doc = concat!("assert_eq!(2", stringify!($SelfT), ".next_power_of_two(), 2);")]
#[doc = concat!("assert_eq!(3", stringify!($SelfT), ".next_power_of_two(), 4);")]
#[doc = concat!("assert_eq!(0", stringify!($SelfT), ".next_power_of_two(), 1);")]
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]