Re: [PATCH v8 5/7] rust: str: add radix prefixed integer parsing functions

2025-04-04 Thread Andreas Hindborg
"Miguel Ojeda" writes: > On Thu, Feb 27, 2025 at 3:39 PM Andreas Hindborg > wrote: >> >> +// SAFETY: We checked that `val` will fit in `Self` >> above. >> +let val: Self = unsafe { >> val.try_into().unwrap_unchecked() }; > > This is wrong -- `val` can b

Re: [PATCH v8 5/7] rust: str: add radix prefixed integer parsing functions

2025-04-04 Thread Miguel Ojeda
On Thu, Feb 27, 2025 at 3:39 PM Andreas Hindborg wrote: > > +// SAFETY: We checked that `val` will fit in `Self` > above. > +let val: Self = unsafe { > val.try_into().unwrap_unchecked() }; This is wrong -- `val` can be the maximum, and thus it does not fi