Skip to content
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

remove unsound experimental coroutines #796

Closed
wants to merge 1 commit into from

Conversation

cyrgani
Copy link
Contributor

@cyrgani cyrgani commented Sep 6, 2024

The following problematic piece of code in Handle::lens is always UB:

let mut base = std::mem::MaybeUninit::<T>::uninit();
let field = f(std::mem::transmute(base.as_mut_ptr())) as *mut _ as *mut u8;

The MaybeUninit::as_mut_ptr documentation says:

Reading from this pointer or turning it into a reference is undefined behavior unless the MaybeUninit<T> is initialized.

But f takes a mutable reference as argument, so this is UB.

Since I did not see an easy fix for this and it is only an experimental API, it should be fine to just remove it.

Closes #723.

@cyrgani
Copy link
Contributor Author

cyrgani commented Sep 7, 2024

Closing this since #798 includes this change.

@cyrgani cyrgani closed this Sep 7, 2024
@cyrgani cyrgani deleted the tweens branch September 8, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tweens::linear is unsound
1 participant