Closed
Description
I wanted to issue a bug report in bumpalo
and show an example of a vector error message from std
But I got a very strange suggest from compiler:
fn foo() -> impl Iterator<Item = usize> {
let arena = Bump::new();
// vec![in &arena; 1, 2, 3].into_iter()
let mut vec = Vec::new_in(&arena);
vec.push(1);
vec.push(2);
vec.push(3);
vec.into_iter()
}
error[E0597]: `arena` does not live long enough
--> src\main.rs:8:31
|
8 | let mut vec = Vec::new_in(&arena);
| ^^^^^^ borrowed value does not live long enough
...
12 | vec.into_iter()
| --------------- opaque type requires that `arena` is borrowed for `'static`
13 | }
| - `arena` dropped here while still borrowed
|
help: you can add a bound to the opaque type to make it last less than `'static` and match `'static`
|
12 | vec.into_iter() + 'static
| +++++++++
I even thought there was progress in type_ascription
feature
In general, this message is very strange. Right now in growth I can't make arena live longer (I can, but not through annotations)