From 4c7c9de8acc7abc1788d6134716f3aeff8616300 Mon Sep 17 00:00:00 2001 From: Nico Lehmann Date: Fri, 1 Aug 2025 13:55:18 -0700 Subject: [PATCH] Fix safety comment for new_unchecked in niche_types --- library/core/src/num/niche_types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/core/src/num/niche_types.rs b/library/core/src/num/niche_types.rs index b92561c9e356d..d57b1d433e51c 100644 --- a/library/core/src/num/niche_types.rs +++ b/library/core/src/num/niche_types.rs @@ -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) } }