Fix safety comment for new_unchecked in niche_types

This commit is contained in:
Nico Lehmann
2025-08-01 13:55:18 -07:00
parent 4b55fe199c
commit 4c7c9de8ac

View File

@@ -46,11 +46,11 @@ macro_rules! define_valid_range_type {
/// primitive without checking whether its zero.
///
/// # Safety
/// Immediate language UB if `val == 0`, as it violates the validity
/// invariant of this type.
/// Immediate language UB if `val` is not within the valid range for this
/// type, as it violates the validity invariant.
#[inline]
pub const unsafe fn new_unchecked(val: $int) -> Self {
// SAFETY: Caller promised that `val` is non-zero.
// SAFETY: Caller promised that `val` is within the valid range.
unsafe { $name(val) }
}