// `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`
}
-
-#[test]
-fn rc_from_vec_opt() {
- let mut v = Vec::with_capacity(64);
- v.push(0usize);
- let addr = v.as_ptr().cast::<u8>();
- let rc: Rc<[_]> = v.into();
- unsafe {
- assert_eq!(
- rc.as_ptr().cast::<u8>().offset_from(addr),
- (std::mem::size_of::<usize>() * 2) as isize,
- "Vector allocation not reused"
- );
- }
-}