diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/dynamically-sized-types/dst-coerce-rc.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/dynamically-sized-types/dst-coerce-rc.rs')
-rw-r--r-- | src/test/ui/dynamically-sized-types/dst-coerce-rc.rs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/test/ui/dynamically-sized-types/dst-coerce-rc.rs b/src/test/ui/dynamically-sized-types/dst-coerce-rc.rs deleted file mode 100644 index 683fa6850..000000000 --- a/src/test/ui/dynamically-sized-types/dst-coerce-rc.rs +++ /dev/null @@ -1,42 +0,0 @@ -// run-pass -#![allow(unused_variables)] -#![allow(stable_features)] -// Test a very simple custom DST coercion. - -#![feature(core, rc_weak)] - -use std::cell::RefCell; -use std::rc::{Rc, Weak}; - -trait Baz { - fn get(&self) -> i32; -} - -impl Baz for i32 { - fn get(&self) -> i32 { - *self - } -} - -fn main() { - let a: Rc<[i32; 3]> = Rc::new([1, 2, 3]); - let b: Rc<[i32]> = a; - assert_eq!(b[0], 1); - assert_eq!(b[1], 2); - assert_eq!(b[2], 3); - - let a: Rc<i32> = Rc::new(42); - let b: Rc<dyn Baz> = a.clone(); - assert_eq!(b.get(), 42); - - let c: Weak<i32> = Rc::downgrade(&a); - let d: Weak<dyn Baz> = c.clone(); - - let _c = b.clone(); - - let a: Rc<RefCell<i32>> = Rc::new(RefCell::new(42)); - let b: Rc<RefCell<dyn Baz>> = a.clone(); - assert_eq!(b.borrow().get(), 42); - // FIXME - let c: Weak<RefCell<dyn Baz>> = Rc::downgrade(&a) as Weak<_>; -} |