-
Notifications
You must be signed in to change notification settings - Fork 187
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
push_next
being safe to call is unsound
#905
Comments
Yeah that is definitely a problem. Any solution involves a breaking change, and I'm not sure about yanking or releasing a breaking followup soon because of this. It's been there for quite some time. For solving this, I see two options: mark |
That sulution sounds awesome to me! I also think yanking is futile when a bug has existed for many (breaking) releases. |
We should mark
|
Seeing as it's good practice to minimize the scope of |
Opened a draft at #909 following my suggestion from #905 (comment), while keeping implementation discussions here. I've also considered not marking After all I've never actually seen anyone building up pointer chains like this, as @Rua brought up in #906 we don't even provide And obviously, if we go this route, there'll be an accompanying |
I concur that the use case for pushing a whole chain at once is unclear, and a simpler method is appealing. I'm not even sure we should it's worth preserving the existing logic under another name. Still, I'm wary because (semver break or not) introducing a dynamic |
Exactly, this is my only reason to hold back such a "sneaky" UB |
Just to chime in my opinion as a user of this lib: I've always assumed that For most use cases the compiler ought to be smart enough to strip away the Having tl;dr: IMO just make |
This code triggers UB using only safe code:
Personally I would prefer having a function that doesn't dereference raw pointers at all, because at least we I don't think need this functionality and it would alleviate having the unsafe block when calling
push_next
.The text was updated successfully, but these errors were encountered: