]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #90851 - ibraheemdev:downcast-unchecked, r=scottmcm
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 4 Dec 2021 01:26:21 +0000 (02:26 +0100)
committerGitHub <noreply@github.com>
Sat, 4 Dec 2021 01:26:21 +0000 (02:26 +0100)
commit0bd4ee79e099a75a13396de272278c9ad8192bd5
tree32f416cc481be4a995c6090f5769225ce8a9eca8
parentf99cd4022a0f0974f183f8459c9dda86568a90a8
parent4ec5cdc94b83e1a37c628033597c17c4d7645128
Rollup merge of #90851 - ibraheemdev:downcast-unchecked, r=scottmcm

Add unchecked downcast methods

```rust
impl dyn Any (+ Send + Sync) {
    pub unsafe fn downcast_ref_unchecked<T: Any>(&self) -> &T;
    pub unsafe fn downcast_mut_unchecked<T: Any>(&mut self) -> &mut T;
}

impl<A: Allocator> Box<dyn Any (+ Send + Sync), A> {
    pub unsafe fn downcast_unchecked<T: Any>(&self) -> Box<T, A>;
}
```
library/alloc/src/boxed.rs