fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
899 B15 linesraw
1error[E0597]: `a` does not live long enough
2  --> $DIR/unnamed-closure-doesnt-life-long-enough-issue-67634.rs:2:49
3   |
4LL |     [0].iter().flat_map(|a| [0].iter().map(|_| &a));
5   |                                             -   ^- ...but `a` will be dropped here, when the enclosing closure returns
6   |                                             |   |
7   |                                             |   `a` would have to be valid for `'_`...
8   |                                             has type `&i32`
9   |
10   = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments
11   = note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references>
12
13error: aborting due to previous error
14
15For more information about this error, try `rustc --explain E0597`.