Skip to content

Commit d56b667

Browse files
authored
Unrolled build for #144797
Rollup merge of #144797 - nilehmann:safety-comment-niche, r=Noratrieb Update safety comment for new_unchecked in niche_types Change the safety comment on `new_unchecked` to mention the valid range instead of 0. I noticed this while working on https://github.com/model-checking/verify-rust-std
2 parents a65b04d + 4c7c9de commit d56b667

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/core/src/num/niche_types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ macro_rules! define_valid_range_type {
4646
/// primitive without checking whether its zero.
4747
///
4848
/// # Safety
49-
/// Immediate language UB if `val == 0`, as it violates the validity
50-
/// invariant of this type.
49+
/// Immediate language UB if `val` is not within the valid range for this
50+
/// type, as it violates the validity invariant.
5151
#[inline]
5252
pub const unsafe fn new_unchecked(val: $int) -> Self {
53-
// SAFETY: Caller promised that `val` is non-zero.
53+
// SAFETY: Caller promised that `val` is within the valid range.
5454
unsafe { $name(val) }
5555
}
5656

0 commit comments

Comments
 (0)