Skip to content
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

Tracking issue for weak_ptr_eq #55981

Closed
1 of 2 tasks
Thomasdezeeuw opened this issue Nov 15, 2018 · 11 comments · Fixed by #61797
Closed
1 of 2 tasks

Tracking issue for weak_ptr_eq #55981

Thomasdezeeuw opened this issue Nov 15, 2018 · 11 comments · Fixed by #61797
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Thomasdezeeuw
Copy link
Contributor

Thomasdezeeuw commented Nov 15, 2018

This is a tracking issue for rc::Weak::ptr_eq and sync::Weak::ptr_eq.

Feature gate: #![feature(weak_ptr_eq)].

Steps:


Old issue:

Rc has a function called ptr_eq it compares if the Rc points to the value, not the values themselves. I would like to add the same function to Weak. I got an implementation but have two questions:

  • Does this require an RFC? Or is this small enough to do without one.
  • What to do with dangling pointer, e.g. created by Weak::new(). I would argue always return false if either one is dangling.
@jethrogb
Copy link
Contributor

This is a small API introduction, it doesn't require an RFC. You can just file a PR.

@F001
Copy link
Contributor

F001 commented Nov 22, 2018

I have a question that why Weak didn't have strong_count and weak_count methods either.
I think these methods are also useful.

// when inner ptr is dangling, returns None.
pub fn weak_count(this: &Weak<T>) -> Option<usize>

@Thomasdezeeuw
Copy link
Contributor Author

@F001 I agree, you could create a PR and then someone from the libs team will comment (atleast that is what I did).

kennytm added a commit to kennytm/rust that referenced this issue Dec 4, 2018
Add Weak.ptr_eq

I hope the doc tests alone are good enough.

We also might want to discuss the dangling pointer case (from `Weak::new()`).

Updates rust-lang#55981.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Dec 4, 2018
Add Weak.ptr_eq

I hope the doc tests alone are good enough.

We also might want to discuss the dangling pointer case (from `Weak::new()`).

Updates rust-lang#55981.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Dec 5, 2018
Add Weak.ptr_eq

I hope the doc tests alone are good enough.

We also might want to discuss the dangling pointer case (from `Weak::new()`).

Updates rust-lang#55981.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 5, 2018
Add Weak.ptr_eq

I hope the doc tests alone are good enough.

We also might want to discuss the dangling pointer case (from `Weak::new()`).

Updates rust-lang#55981.
pietroalbini added a commit to pietroalbini/rust that referenced this issue Dec 5, 2018
Add Weak.ptr_eq

I hope the doc tests alone are good enough.

We also might want to discuss the dangling pointer case (from `Weak::new()`).

Updates rust-lang#55981.
@Thomasdezeeuw Thomasdezeeuw changed the title Add Weak.ptr_eq Tracking issue for weak_ptr_eq Dec 6, 2018
@Thomasdezeeuw
Copy link
Contributor Author

I've updated the first comment to turn the issue into a tracking issue.

@jonas-schievink jonas-schievink added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC labels Jan 27, 2019
@vorner
Copy link
Contributor

vorner commented May 11, 2019

Hello. This looks potentially useful. How long does a feature this small need to sit around before it's considered for stabilization? (if I'm not missing something, there's no issue raised with this currently)

@Thomasdezeeuw
Copy link
Contributor Author

If the team agrees I can make a stabilisation pr for 1.35/1.36.

@jonas-schievink
Copy link
Contributor

Nominating to discuss stabilization. See PR #61797.

Centril added a commit to Centril/rust that referenced this issue Jun 17, 2019
make `Weak::ptr_eq`s into methods

This makes the `Weak::ptr_eq`s associated function into methods. There's no reason for methods on `Weak`s to be associated functions, as there is no `Dered` thus no possibility of a collision. Also: methods can be called using the associated function syntax.

follow up on rust-lang#55987
[Tracking issue for weak_ptr_eq](rust-lang#55981)
@alexcrichton
Copy link
Member

I'm going to de-nominate this because stabilization happens outside of triage meetings and happens when a libs team member feels confident enough to propose stabilization.

@Thomasdezeeuw
Copy link
Contributor Author

Anything I can do to advance the stabilisation?

@jonas-schievink
Copy link
Contributor

@Thomasdezeeuw Apparently #61797 is now nominated, so the libs team should discuss it soon

@Thomasdezeeuw
Copy link
Contributor Author

@jonas-schievink I missed that, thanks.

Centril added a commit to Centril/rust that referenced this issue Sep 14, 2019
@bors bors closed this as completed in dee08ba Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants