-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix(lex): Deprecate unsound OsStrExt::split_at
#4802
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick fix!
@@ -193,6 +193,7 @@ pub trait OsStrExt: private::Sealed { | |||
/// assert_eq!("Per", first); | |||
/// assert_eq!(" Martin-Löf", last); | |||
/// ``` | |||
#[deprecated(since = "4.1.0", note = "This is not sound for all `index`")] | |||
fn split_at(&self, index: usize) -> (&OsStr, &OsStr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this one also be marked unsafe
? Technically a BC break, but that's ok given the time scale and circumstances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather just soon release a v0.5 with it removed. This is an intermediate release so it will work with clap v4.1.x (as master is already prepped for v4.2.x)
This is a followup to comments on clap-rs#4802
Addressed the comments in #4803 Thanks for looking! |
This is a followup to comments on clap-rs#4802
This also clarifies safety requirements throughout the code
OsStr
is nottransparent
yet but effectively it isOsStr
does have invariants to uphold, similar tostr
Fixes #4800