fn main() {
struct Foo {
foo: String,
};
struct Bar {
bar: Vec<Foo>,
}
let bar = Bar{ bar: Vec::new() };
for b in &bar.bar {
let part = reqwest::multipart::Part::text("").file_name(&b.foo);
}
}
And the error is:
error[E0597]: `bar.bar` does not live long enough
--> src\main.rs:20:14
|
20 | for b in &bar.bar {
| ^^^^^^^^
| |
| borrowed value does not live long enough
| argument requires that `bar.bar` is borrowed for `'static`
...
57 | }
| - `bar.bar` dropped here while still borrowed
What does it mean? Isn't everything dropped after the loop? Who is borrowing bar.bar
?