]> git.lizzy.rs Git - rust.git/commit
Auto merge of #50836 - jsgf:arc-downcast, r=SimonSapin
authorbors <bors@rust-lang.org>
Fri, 1 Jun 2018 01:09:25 +0000 (01:09 +0000)
committerbors <bors@rust-lang.org>
Fri, 1 Jun 2018 01:09:25 +0000 (01:09 +0000)
commitb7a9d4ea744c9a99952bc4576727b57c58c0e958
treeeb6581b24d1cbb2e9e2bde8c4d9e3b0b403ee6c4
parentefc508ba4ce9bc0ac3570436b3400c6e0b0f1dfb
parent87c3d7bee52fb99f922c77fa267729b7898bc9a6
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.