-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase MSRV to 1.57 & completely check null termination of C strings at compile time. #426
Conversation
In each function, explicitly use the implicit conversion of `&[T]` to `*const T`/`&mut [T]` to `* mut T` to eliminate one `as *const T`/`as *mut T` respectively. Instead of relying on the remaining cast in each function being valid for all `T`, reduce the scope of the assumption to `u8`, and add a TODO avoid eliminating the use of the assumption.
I don't think this is a good approach. It adds a whole bunch of code to just... introduce a Also, in the latest version we use |
Do more complete NUL termination checking, at compile-time. Remove the `unsafe` from the function as it is now memory-safe.
bf7c4b1
to
f557cbf
Compare
Also, could you please untie this PR from your commits in #425? It makes harder to review it. |
I doubt we will be able to increase MSRV beyond 1.63 any time soon because 1.63 is what Debian 8 uses, and many crates are trying to stay compatible with it through mid-2025 or so.
|
Branch briansmith:b/1.64-2 contains the MSRV 1.64 code that replaces |
It would be extra work. I would rather work together on #425 first. Note that this is just a draft PR to help understand PR #425. You can see the difference between the two branches using the GitHub comparison tool, which is "live": https://github.com/briansmith/getrandom/compare/b/cast-1...briansmith:getrandom:b/cstr?expand=1 |
Do null terminator checking more completely and at compile time.
I don't think we need this anymore after #427 merge. |
No description provided.