-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Remove FromBytesWithNulErrorKind and make FromVecWithNulErrorKind more actionable #143163
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
base: master
Are you sure you want to change the base?
Remove FromBytesWithNulErrorKind and make FromVecWithNulErrorKind more actionable #143163
Conversation
r? libs-api |
This comment has been minimized.
This comment has been minimized.
@PixelDust22 You are proposing making an instantly stable change, which is generally not what we do even for small features if we can avoid it. |
@workingjubilee Given that #134143 was instantly stable, I don't see why this one couldn't be. This change really should've been a part of #134143. |
@PixelDust22 Adding the getter function is a new API. |
The change in #134143 was instantly stable because there was no way to feature flag replacing a struct with an enum. Adding a trivial function, however, is something that can be done under a feature flag. Usually doing so is just a formality, but it needs an FCP to add it as stable API in any case. |
#134143 converted
FromBytesWithNulError
into an enum to address rust-lang/libs-team#493 (CStr::from_bytes_with_nul
returns non-actionable error result)However, the
FromVecWithNulError
returned fromCString::from_vec_with_nul
has a similar issue of returning non-actionable error result because you can't get theFromBytesWithNulErrorKind
out ofFromVecWithNulError
.Additionally, #134143 creates
FromBytesWithNulError
alongside the existingFromBytesWithNulErrorKind
which is exactly the same.This PR removes
FromBytesWithNulErrorKind
so thatFromVecWithNulError
usesFromBytesWithNulError
directly. It also adds a new methodkind
toFromVecWithNulError
so that the user can access the underlying error.This is not a breaking change because
FromBytesWithNulErrorKind
is private, and we're only adding a method toFromVecWithNulError
.cc @nyurik