#![allow(unused_variables)] fn main() { use std::mem; let story = String::from("Once upon a time..."); let mut story = mem::ManuallyDrop::new(story); let ptr = story.as_mut_ptr(); let len = story.len(); let capacity = story.capacity(); assert_eq!(19, len); let s = unsafe { String::from_raw_parts(ptr, len, capacity) }; assert_eq!(String::from("Once upon a time..."), s); }