#[derive(Debug)]
struct Foo {
f: String,
}
fn main() {
let a = Foo { f: String::from("hello") };
let y: &Foo;
if false {
// borrow
let x = &a;
y = &a;
}
println!("here {}", y.f);
}
Hi , I’m new in rust , and have one question , why this code return this error "use of possibly uninitialized variable: y.f
"
if Y is in scope and A is a valid reference?
Thansk.