Skip to content

Commit f7c641b

Browse files
committed
Improve documentation of next_power_of_two
Clarify overflow behavior of `next_power_of_two`. Related Issue: #18604
1 parent c398efc commit f7c641b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libcore/num/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,7 @@ macro_rules! uint_impl {
23282328
}
23292329

23302330
/// Returns the smallest power of two greater than or equal to `self`.
2331-
/// Unspecified behavior on overflow.
2331+
/// More details about overflow behavior can be found in [RFC 560].
23322332
///
23332333
/// # Examples
23342334
///
@@ -2338,6 +2338,8 @@ macro_rules! uint_impl {
23382338
/// assert_eq!(2u8.next_power_of_two(), 2);
23392339
/// assert_eq!(3u8.next_power_of_two(), 4);
23402340
/// ```
2341+
///
2342+
/// [RFC 560]: https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md
23412343
#[stable(feature = "rust1", since = "1.0.0")]
23422344
#[inline]
23432345
pub fn next_power_of_two(self) -> Self {

0 commit comments

Comments
 (0)