-
Notifications
You must be signed in to change notification settings - Fork 13.3k
NoUnsafeCell
errors proliferate even when using AssertRecoverSafe
or manually implementing RecoverSafe
#30510
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
Comments
Hm, so the first case here should work (e.g. |
Is the second case not allowed then?
I figured And what about moving values into the closure? |
Oh wait sorry I misread your second example, I failed to notice the manual This is basically a case where closure captures are coming into play. The closures aren't annotated with You should be able to get around this via either Certainly an interesting interaction going on here though. One would likely expect that if |
There's |
Nah unfortunately that'd defeat the purpose of the |
Types like `&AssertRecoverSafe<T>` and `Rc<AssertRecoverSafe<T>>` were mistakenly not considered recover safe, but the point of the assertion wrapper is that it indeed is! This was caused by an interaction between the `RecoverSafe` and `NoUnsafeCell` marker traits, and this is updated by adding an impl of the `NoUnsafeCell` marker trait for `AssertRecoverSafe` to ensure that it never interacts with the other negative impls of `RecoverSafe`. cc rust-lang#30510
It's unfortunate that
|
Hm interesting, I guess yeah you'll be forced to move the reference inside the wrapper rather than having a reference to the wrapper |
Is it possible to implement |
I guess I can just use |
Yeah currently you can implement For now though yeah I'd recommend just using |
@alexcrichton the problem with moving at this point in time is that I call It would help if I'll probably just implement Thanks anyways! |
Oh yeah we could totally add more traits like |
Types like `&AssertRecoverSafe<T>` and `Rc<AssertRecoverSafe<T>>` were mistakenly not considered recover safe, but the point of the assertion wrapper is that it indeed is! This was caused by an interaction between the `RecoverSafe` and `NoUnsafeCell` marker traits, and this is updated by adding an impl of the `NoUnsafeCell` marker trait for `AssertRecoverSafe` to ensure that it never interacts with the other negative impls of `RecoverSafe`. cc rust-lang#30510
Updating code to modern functions and traits in |
Test Case 1: Playground
Test Case 2: Playground
Both produce errors like this:
CC @alexcrichton
The text was updated successfully, but these errors were encountered: