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 Rc::downcast (`rc_downcast` feature) #44608

Closed
bluss opened this Issue Sep 15, 2017 · 16 comments

Comments

Projects
None yet
7 participants
@bluss
Contributor

bluss commented Sep 15, 2017

Tracking issue for the Rc::downcast method implemented in #44273

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Mar 17, 2018

Contributor

Looks good to me to stabilize.

@rfcbot fcp merge

Contributor

SimonSapin commented Mar 17, 2018

Looks good to me to stabilize.

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Mar 17, 2018

Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams:

Concerns:

Once a majority of reviewers approve (and none object), 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!

See this document for info about what commands tagged team members can give me.

rfcbot commented Mar 17, 2018

Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams:

Concerns:

Once a majority of reviewers approve (and none object), 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!

See this document for info about what commands tagged team members can give me.

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Mar 19, 2018

Member

@rfcbot concern arc

We should add to Arc as well for consistency, right?

Member

alexcrichton commented Mar 19, 2018

@rfcbot concern arc

We should add to Arc as well for consistency, right?

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Mar 19, 2018

Contributor

On the implementation PR:

Arc is skipped because Any itself has no downcast for the case that makes most sense: Any + Send + Sync

Why we don't implement downcast for Any + Send + Sync? Other than it isn't terribly necessary.

We can still do that.

Contributor

SimonSapin commented Mar 19, 2018

On the implementation PR:

Arc is skipped because Any itself has no downcast for the case that makes most sense: Any + Send + Sync

Why we don't implement downcast for Any + Send + Sync? Other than it isn't terribly necessary.

We can still do that.

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Mar 19, 2018

Member

Indeed!

Member

alexcrichton commented Mar 19, 2018

Indeed!

@bluss

This comment has been minimized.

Show comment
Hide comment
@bluss

bluss Mar 19, 2018

Contributor

Hehe, I can't quite find the right way to pick the right implementations.

All four combinations are "Trait", "Trait + Send", "Trait + Sync", "Trait + Send + Sync".

The frugal approach is just the first one for Rc and just the last one for Arc. The perfect would be to write just one that covered them all, for each of Rc and Arc. I think the pragmatic would be all four for both Rc and Arc.

Contributor

bluss commented Mar 19, 2018

Hehe, I can't quite find the right way to pick the right implementations.

All four combinations are "Trait", "Trait + Send", "Trait + Sync", "Trait + Send + Sync".

The frugal approach is just the first one for Rc and just the last one for Arc. The perfect would be to write just one that covered them all, for each of Rc and Arc. I think the pragmatic would be all four for both Rc and Arc.

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Mar 19, 2018

Member

@bluss I'd be ok conservatively just doing Arc<Any + Send + Sync> as I doubt most other combinations don't actually show up that often in practice

Member

alexcrichton commented Mar 19, 2018

@bluss I'd be ok conservatively just doing Arc<Any + Send + Sync> as I doubt most other combinations don't actually show up that often in practice

@jsgf

This comment has been minimized.

Show comment
Hide comment
@jsgf

jsgf May 17, 2018

Contributor

Hi! I ran into this today. Any objections if I put together a PR for Arc<Any + Send + Sync>?

Contributor

jsgf commented May 17, 2018

Hi! I ran into this today. Any objections if I put together a PR for Arc<Any + Send + Sync>?

@sfackler

This comment has been minimized.

Show comment
Hide comment
@sfackler

sfackler May 17, 2018

Member

SGTM

Member

sfackler commented May 17, 2018

SGTM

@jsgf

This comment has been minimized.

Show comment
Hide comment
@jsgf

jsgf May 17, 2018

Contributor

Should I reuse this issue and rc_downcast, or create new ones?

Contributor

jsgf commented May 17, 2018

Should I reuse this issue and rc_downcast, or create new ones?

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin May 17, 2018

Contributor

Using the same tracking issue sounds fine: it’s a identical copy of a fairly small function. By the way, I think you can also remove an unsafe block by using the (relatively) new cast method of NonNull, instead of NonNull::new_unchecked.

Contributor

SimonSapin commented May 17, 2018

Using the same tracking issue sounds fine: it’s a identical copy of a fairly small function. By the way, I think you can also remove an unsafe block by using the (relatively) new cast method of NonNull, instead of NonNull::new_unchecked.

@jsgf

This comment has been minimized.

Show comment
Hide comment
@jsgf

jsgf May 17, 2018

Contributor

I also need to add Any + Send + Sync implementations for is, downcast_ref and Debug to std::any::Any. Do they need feature guards, or can I just insta-stable them? If so, what version would I put in since = "..."?

Contributor

jsgf commented May 17, 2018

I also need to add Any + Send + Sync implementations for is, downcast_ref and Debug to std::any::Any. Do they need feature guards, or can I just insta-stable them? If so, what version would I put in since = "..."?

jsgf added a commit to jsgf/rust that referenced this issue May 17, 2018

Implement `downcast` for `Arc<Any + Send + Sync>`
We only need to implement it for `Any + Send + Sync` because in practice
that's the only useful combination for `Arc` and `Any`.

Implementation for rust-lang#44608 under the `rc_downcast` feature.

@jsgf jsgf referenced this issue May 17, 2018

Merged

Arc downcast #50836

jsgf added a commit to jsgf/rust that referenced this issue May 17, 2018

Implement `downcast` for `Arc<Any + Send + Sync>`
We only need to implement it for `Any + Send + Sync` because in practice
that's the only useful combination for `Arc` and `Any`.

Implementation for rust-lang#44608 under the `rc_downcast` feature.

jsgf added a commit to jsgf/rust that referenced this issue May 17, 2018

Implement `downcast` for `Arc<Any + Send + Sync>`
We only need to implement it for `Any + Send + Sync` because in practice
that's the only useful combination for `Arc` and `Any`.

Implementation for rust-lang#44608 under the `rc_downcast` feature.

jsgf added a commit to jsgf/rust that referenced this issue May 18, 2018

Implement `downcast` for `Arc<Any + Send + Sync>`
We only need to implement it for `Any + Send + Sync` because in practice
that's the only useful combination for `Arc` and `Any`.

Implementation for rust-lang#44608 under the `rc_downcast` feature.

jsgf added a commit to jsgf/rust that referenced this issue May 31, 2018

Implement `downcast` for `Arc<Any + Send + Sync>`
We only need to implement it for `Any + Send + Sync` because in practice
that's the only useful combination for `Arc` and `Any`.

Implementation for rust-lang#44608 under the `rc_downcast` feature.

bors added a commit that referenced this issue Jun 1, 2018

Auto merge of #50836 - jsgf:arc-downcast, r=SimonSapin
Arc downcast

Implement `downcast` for `Arc<Any + Send + Sync>` as part of #44608, and gated by the same `rc_downcast` feature.

This PR is mostly lightly-edited cut'n'paste.

This has two additional changes:
- The `downcast` implementation needs `Any + Send + Sync` implementations for `is` and `Debug`, and I added `downcast_ref` and `downcast_mut` for completeness/consistency. (Can these be insta-stabilized?)
- At @SimonSapin's suggestion, I converted `Arc` and `Rc` to use `NonNull::cast` to avoid an `unsafe` block in each which tidied things up nicely.
@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Jun 6, 2018

Contributor

@rfcbot resolve arc

The requested feature was implemented in #50836.

Contributor

SimonSapin commented Jun 6, 2018

@rfcbot resolve arc

The requested feature was implemented in #50836.

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Jun 6, 2018

Contributor

Hmm it looks like only @alexcrichton can tell rfcbot to resolve the concern here, but I think we can consider the spirit of the process to be satisfied (if not the letter) and I would accept a stabilization PR. (Alex is away for a month.)

Contributor

SimonSapin commented Jun 6, 2018

Hmm it looks like only @alexcrichton can tell rfcbot to resolve the concern here, but I think we can consider the spirit of the process to be satisfied (if not the letter) and I would accept a stabilization PR. (Alex is away for a month.)

F001 added a commit to F001/rust that referenced this issue Jun 24, 2018

Implement `downcast` for `Arc<Any + Send + Sync>`
We only need to implement it for `Any + Send + Sync` because in practice
that's the only useful combination for `Arc` and `Any`.

Implementation for rust-lang#44608 under the `rc_downcast` feature.
@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jun 27, 2018

Member

@rfcbot resolved arc

Member

alexcrichton commented Jun 27, 2018

@rfcbot resolved arc

@rfcbot

This comment has been minimized.

Show comment
Hide comment
@rfcbot

rfcbot Jun 27, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

rfcbot commented Jun 27, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

tmccombs added a commit to tmccombs/rust that referenced this issue Jul 6, 2018

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jul 7, 2018

@bors bors closed this in #52103 Jul 7, 2018

mati865 added a commit to mati865/rust that referenced this issue Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment