Repository navigation
Conversation
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? libs |
|
It was already assigned to libs, but, sure. Is there a reason why this API isn't offered on |
|
I don't think there was any. The ACP only proposed it for I can add it, but I'm not sure if it belongs in this PR. |
|
I mean, I don't like the precedent of stabilising asymmetric impls on |
|
I assume that Rc variant should be on its own tracking issue and ACP? |
|
I would say that unless there's significant reason to make things different on |
This comment has been minimized.
This comment has been minimized.
|
Once #163489 merges and this is rebased on top of that, I think it's okay to FCP merge, since Thank you! |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
eae707b to
89f1208
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot ready Rebased and updated :D |
|
@rfcbot merge libs |
|
@clarfonthey has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/libs-ping: FCP proposed for libs, please feel free to register concerns. |
|
Can I suggest adding a comment for the obvious time-of-check to time-of-use bug to use the option in ::get_mut directly instead (or similar to the comment on strong_count)? I know for people dealing a lot with concurrency this should be obvious but yeah. Or maybe one can do that in a clippy lint |
|
The point of FCP is for everyone to comment, not just libs members, so, you absolutely can make that suggestion. We do specifically take care to make sure the atomics will work appropriately, but yes, that should be mentioned. Note that regardless, thread safety will be upheld, but there are cases where allocating is less than desired. (Also, I think we can just make this a prereq for merging, not block the FCP, but would be happy if anyone wants to propose a change in this PR or elsewhere.) |
|
In cases like the doc suggestion that |
|
Yeah, I guess it does clarify that "no clones occur in between" and that is effectively pointing out the TOCTOU issue. So maybe the docs are okay as-is, but if anyone has a concrete suggestion, that seems reasonable. We also just did a release so we have time after this lands on nightly to fix docs before it ends up in a release. |
|
The last example does use ... Thus, the following code is valid:
[code]
Either of the following changes would make the example unsound:
* Using `get_mut` to create a mutable reference which is kept around while reading via `pointer`
* Cloning or dropping `arc` between checking `is_unique` and accessing `pointer`(thought I had a third bullet point but now I can't remember what)
I think it's pretty much always worth making sure the docs are in a state we're happy with before actually pressing the merge button on stabilization. Once the "this must be done to get X feature I want" motivation goes away, the number of people actually interested in doing such a docs update gets a lot closer to 0 :) and there's typically no need to rush the stabilization PR. |
View all comments
Stabilization report:
Closes #138938
{Arc,Rc}::is_unique, is a function that allows determining whether there is exactly one strong count and zero weak counts to anArc/Rc.Implementation history
Implementation: #138939
Public api
@rustbot modify labels: +T-libs
This is a pretty small feature, so opening this to hopefully get a FCP started.