Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct S<'a> {
- s: &'a mut String,
- }
- #[allow(unused_variables)]
- fn main() {
- let s = &mut "hello".to_string();
- let t = S { s };
- let u = &t;
- //let w: &mut String = u.s;
- //w.push_str(" ya");
- //assert_eq!("hello ya", u.s);
- //assert_eq!("hello ya", w);
- let w: &String = u.s;
- let mut x: String = "hi".to_string();
- let y: &String = &x;
- let z: &mut String = &mut x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement