diff options
Diffstat (limited to 'library/alloc/tests/rc.rs')
| -rw-r--r-- | library/alloc/tests/rc.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/library/alloc/tests/rc.rs b/library/alloc/tests/rc.rs index 499740e738a..29dbdcf225e 100644 --- a/library/alloc/tests/rc.rs +++ b/library/alloc/tests/rc.rs @@ -205,3 +205,20 @@ fn weak_may_dangle() { // `val` dropped here while still borrowed // borrow might be used here, when `val` is dropped and runs the `Drop` code for type `std::rc::Weak` } + +#[allow(unused)] +mod pin_coerce_unsized { + use alloc::rc::{Rc, UniqueRc}; + use core::pin::Pin; + + pub trait MyTrait {} + impl MyTrait for String {} + + // Pin coercion should work for Rc + pub fn pin_rc(arg: Pin<Rc<String>>) -> Pin<Rc<dyn MyTrait>> { + arg + } + pub fn pin_unique_rc(arg: Pin<UniqueRc<String>>) -> Pin<UniqueRc<dyn MyTrait>> { + arg + } +} |
