Skip to content

Commit 5042182

Browse files
committed
Add test to dst-coerce-rc.rs
1 parent 8bf4651 commit 5042182

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/run-pass/dst-coerce-rc.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
// Test a very simple custom DST coercion.
1212

13-
#![feature(core)]
13+
#![feature(core, rc_weak)]
1414

1515
use std::cell::RefCell;
16-
use std::rc::Rc;
16+
use std::rc::{Rc, Weak};
1717

1818
trait Baz {
1919
fn get(&self) -> i32;
@@ -36,9 +36,13 @@ fn main() {
3636
let b: Rc<Baz> = a.clone();
3737
assert_eq!(b.get(), 42);
3838

39+
let c: Weak<i32> = a.downgrade();
40+
let d: Weak<Baz> = c.clone();
41+
3942
let _c = b.clone();
4043

4144
let a: Rc<RefCell<i32>> = Rc::new(RefCell::new(42));
4245
let b: Rc<RefCell<Baz>> = a.clone();
4346
assert_eq!(b.borrow().get(), 42);
47+
let c: Weak<RefCell<Baz>> = a.downgrade();
4448
}

0 commit comments

Comments
 (0)