-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Implement ACP 429: add LazyCell/Lock::get[_mut]()
, DerefMut
and force_mut()
#129334
base: master
Are you sure you want to change the base?
Implement ACP 429: add LazyCell/Lock::get[_mut]()
, DerefMut
and force_mut()
#129334
Conversation
r? libs-api |
Weird, rustbot seems to be sleeping... |
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.
The implementation looks good to me, r=me with the nit resolved after the FCP completes.
…force_mut()` In the implementation of `force_mut()`, I choose performance over safety. For `LazyLock` this isn't really a choice; the code has to be unsafe. But for `LazyCell`, we can have a full-safe implementation, but it will be a bit less performant, so I went with the unsafe approach. `DerefMut` is instantly stable, as a trait impl; as such, I decided to also instantly stabilize `force_mut()`, since it makes little sense to have one but not the other.
2ba55e3
to
37732f5
Compare
Gentle ping on this PR, would love this to be merged soon:) |
@SteveLauC This depends on a T-libs-api member starting a FCP. |
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.
New APIs need to land as unstable. And an FCP isn't needed for that. There should also be a tracking issue. And the ACP should be linked.
Looks like this PR includes Can you split this into two? One that's just T-libs and only adds unstable methods, and one that's T-libs-api with the stable trait impl. The former can land much more easily than the latter. |
@BurntSushi @scottmcm This PR needs FCP for For |
so you're saying we could land |
That's an option, but that's not what I'm doing in this PR. Instead, I instantly stabilize both. |
☔ The latest upstream changes (presumably #130534) made this pull request unmergeable. Please resolve the merge conflicts. |
In the implementation of
force_mut()
, I choose performance over safety. ForLazyLock
this isn't really a choice; the code has to be unsafe. But forLazyCell
, we can have a full-safe implementation, but it will be a bit less performant, so I went with the unsafe approach.DerefMut
is instantly stable, as a trait impl; as such, I decided to also instantly stabilizeforce_mut()
, since it makes little sense to have one but not the other. That means this needs an FCP.@rustbot label +needs-fcp