]> git.lizzy.rs Git - rust.git/commit
alloc: Implement downcast Rc<Any> -> Rc<T>
authorUlrik Sverdrup <bluss@users.noreply.github.com>
Sat, 2 Sep 2017 14:28:48 +0000 (16:28 +0200)
committerUlrik Sverdrup <bluss@users.noreply.github.com>
Sun, 3 Sep 2017 09:32:46 +0000 (11:32 +0200)
commit758a0ce934510b4e77586d02bc30a3d1d5d63cae
tree6cb359706580fcce98cadf84d5fc1549a4d5fbbf
parentefceda220e92f02f7a29a15e4cf56f5a3cdf1792
alloc: Implement downcast Rc<Any> -> Rc<T>

Implement downcast the like it exists for Box.

The implementation avoids using into_raw/from_raw, because the pointer
arithmetic which should cancel does not seem to optimize out at the
moment.

Since Rc<T> is never Send, only Rc<Any> and not Rc<Any + Send>
implements downcast.
src/liballoc/rc.rs