Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- let n = 2; (0..n).flat_map(|x| (0..n).map(|m| (x, m))).collect::<Vec<_>>() // that move is necessary, right?
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0597]: `x` does not live long enough
- --> src/main.rs:6:56
- |
- 6 | let n = 2; (0..n).flat_map(|x| (0..n).map(|m| (x, m))).collect::<Vec<_>>() // that move is necessary, right?
- | --- ^ - - borrowed value needs to live until here
- | | | |
- | | | borrowed value only lives until here
- | | borrowed value does not live long enough
- | capture occurs here
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0597`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment