Skip to content

Commit 87c72a3

Browse files
committed
Add comment about d < 10 vs d < 64
1 parent a542fdc commit 87c72a3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

library/core/src/ascii/ascii_char.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,9 @@ impl AsciiChar {
509509
/// when writing code using this method, since the implementation doesn't
510510
/// need something really specific, not to make those other arguments do
511511
/// something useful. It might be tightened before stabilization.)
512+
// Only `d < 64` is required for safety as described above, but we use `d < 10` as
513+
// in the `assert_unsafe_precondition` inside. See https://github.com/rust-lang/rust/pull/129374
514+
// for some context about the discrepancy.
512515
#[cfg_attr(flux, flux::spec(fn(d: u8{d < 10}) -> Self))]
513516
#[unstable(feature = "ascii_char", issue = "110998")]
514517
#[inline]

library/core/src/num/niche_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ macro_rules! define_valid_range_type {
5353
/// Immediate language UB if `val == 0`, as it violates the validity
5454
/// invariant of this type.
5555
#[inline]
56-
#[cfg_attr(flux, flux::spec(fn (val: $int{ $low <= cast(val) && cast(val) <= $high }) -> Self[{val:cast(val)}]))] // NOTE: `val == 0` comments are stale(?)
56+
#[cfg_attr(flux, flux::spec(fn (val: $int{ $low <= cast(val) && cast(val) <= $high }) -> Self[{val:cast(val)}]))]
5757
pub const unsafe fn new_unchecked(val: $int) -> Self {
5858
// SAFETY: Caller promised that `val` is non-zero.
5959
unsafe { $name(val) }

0 commit comments

Comments
 (0)