Merge pull request #195 from RalfJung/test

Test the Rc::{into,from}_raw roundtrip
This commit is contained in:
Eduard-Mihai Burtescu 2017-06-13 09:14:01 +03:00 committed by GitHub
commit 4566058cc2

View File

@ -8,6 +8,16 @@ fn rc_refcell() -> i32 {
x
}
fn rc_raw() {
let r = Rc::new(0);
let r2 = Rc::into_raw(r.clone());
let r2 = unsafe { Rc::from_raw(r2) };
assert!(Rc::ptr_eq(&r, &r2));
drop(r);
assert!(Rc::try_unwrap(r2).is_ok());
}
fn main() {
rc_refcell();
rc_raw();
}