What is wrong in the following code -
#[derive(Debug)]
struct Rect {
width: u32,
height: u32,
name: &String
}

We need to specify the lifetime of the struct and associate it to the lifetime of the individual references
#[derive(Debug)]
struct Rect<'a> {
width: u32,
height: u32,
name: &'a String
}
fn main() {
println!("Hello, world!");
let name = String::from("rect");
let rect = Rect { width: 10, height: 10, name: &name };
println!("{:?}", rect);
}
struct Shape<'a> {
rect1: Rect<'a>,
rect2: Rect<'a>
}