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

Open
Thomasdezeeuw opened this issue Nov 15, 2018 · 7 comments

Comments

Projects
None yet
5 participants
@Thomasdezeeuw
Copy link
Contributor

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:

  • Implement the RFC (#55987).
  • Stabilization PR.

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

This comment has been minimized.

Copy link
Contributor

commented Nov 15, 2018

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

@F001

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented Nov 22, 2018

@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

Rollup merge of rust-lang#55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
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

Rollup merge of rust-lang#55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
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

Rollup merge of rust-lang#55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
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

Rollup merge of rust-lang#55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
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

Rollup merge of rust-lang#55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
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

This comment has been minimized.

Copy link
Contributor Author

commented Dec 6, 2018

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

@vorner

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

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

@Thomasdezeeuw Thomasdezeeuw referenced a pull request that will close this issue Jun 13, 2019

Open

Stabilise weak_ptr_eq #61797

@jonas-schievink

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

Nominating to discuss stabilization. See PR #61797.

Centril added a commit to Centril/rust that referenced this issue Jun 17, 2019

Rollup merge of rust-lang#61893 - chpio:weak_ptr_eq_methods, r=rkruppe
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.