-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Add Arc::new_cyclic #75505
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
Add Arc::new_cyclic #75505
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -328,6 +328,79 @@ impl<T> Arc<T> { | |||||
| Self::from_inner(Box::leak(x).into()) | ||||||
| } | ||||||
|
|
||||||
| /// Constructs a new `Arc<T>` using a weak reference to itself. Attempting | ||||||
| /// to upgrade the weak reference before this function returns will result | ||||||
| /// in a `None` value. However, the weak reference may be cloned freely and | ||||||
| /// stored for use at a later time. | ||||||
| /// | ||||||
| /// # Examples | ||||||
| /// ``` | ||||||
| /// #![feature(arc_new_cyclic)] | ||||||
| /// #![allow(dead_code)] | ||||||
|
||||||
| /// #![allow(dead_code)] | |
| /// # #![allow(dead_code)] |
Outdated
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.
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?
Outdated
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.
| #[unstable(feature = "arc_new_cyclic", issue = "none")] | |
| #[unstable(feature = "arc_new_cyclic", issue = "75861")] |
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.
Isn't this comment too long?
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.
I find it helpful so +1
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.
I think the indentation for docs is off starting here.
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.
That's odd, is this not just cherry-picking the commits of #72443?
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.
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