Conversation
library/alloc/src/sync.rs
Outdated
| /// # Examples | ||
| /// ``` | ||
| /// #![feature(arc_new_cyclic)] | ||
| /// #![allow(dead_code)] |
There was a problem hiding this comment.
| /// #![allow(dead_code)] | |
| /// # #![allow(dead_code)] |
library/alloc/src/sync.rs
Outdated
| } | ||
|
|
||
| /// Constructs a new `Arc<T>` using a weak reference to itself. Attempting | ||
| /// to upgrade the weak reference before this function returns will result |
There was a problem hiding this comment.
I think the indentation for docs is off starting here.
There was a problem hiding this comment.
That's odd, is this not just cherry-picking the commits of #72443?
There was a problem hiding this comment.
cherry picking took a while due to some conflicts since this pr was small, I pasted the contents directly into respectively files. I ran tidy again now which would have fixed this issues
library/alloc/src/sync.rs
Outdated
| /// let foo = Arc::new_cyclic(|me| Foo { | ||
| /// me: me.clone(), | ||
| /// }); | ||
| /// ``` |
There was a problem hiding this comment.
What is the use case for this example? I don't understand by just looking at the example, maybe we should provide a more realistic use case?
|
|
||
| // Relaxed is valid for the same reason it is on Arc's Clone impl | ||
| match inner.strong.compare_exchange_weak(n, n + 1, Relaxed, Relaxed) { | ||
| // Relaxed is fine for the failure case because we don't have any expectations about the new state. |
There was a problem hiding this comment.
Isn't this comment too long?
RalfJung
left a comment
There was a problem hiding this comment.
As noted before, a similar API should be added to Rc.
library/alloc/src/sync.rs
Outdated
| /// }); | ||
| /// ``` | ||
| #[inline] | ||
| #[unstable(feature = "arc_new_cyclic", issue = "none")] |
There was a problem hiding this comment.
| #[unstable(feature = "arc_new_cyclic", issue = "none")] | |
| #[unstable(feature = "arc_new_cyclic", issue = "75861")] |
|
I've opened up #75861 as a tracking issue with a note about adding a similar API for r=me with the current suggested edits added. |
|
@bors r=KodrAus |
|
📌 Commit c26a8d5 has been approved by |
|
⌛ Testing commit c26a8d5 with merge 9288641c15b77a6a4651e2d4ca5a6583d0e19d92... |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
💔 Test failed - checks-actions |
|
Not sure what this is: But let's hope it's a spurious network issue. @bors retry |
|
☀️ Test successful - checks-actions, checks-azure |
Rework of #72443
References #75861
cc @Diggsey @RalfJung
r? @KodrAus