Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. struct S<'a> {
  2. s: &'a mut String,
  3. }
  4. #[allow(unused_variables)]
  5. fn main() {
  6. let s = &mut "hello".to_string();
  7. let t = S { s };
  8. let u = &t;
  9.  
  10. //let w: &mut String = u.s;
  11. //w.push_str(" ya");
  12. //assert_eq!("hello ya", u.s);
  13. //assert_eq!("hello ya", w);
  14.  
  15. let w: &String = u.s;
  16.  
  17. let mut x: String = "hi".to_string();
  18. let y: &String = &x;
  19. let z: &mut String = &mut x;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement