Skip to content

Instantly share code, notes, and snippets.

@kejadlen
Created November 12, 2016 18:45
Show Gist options
  • Save kejadlen/aa2e5175dc59b8796d90ce8b5d13e2c8 to your computer and use it in GitHub Desktop.
Save kejadlen/aa2e5175dc59b8796d90ce8b5d13e2c8 to your computer and use it in GitHub Desktop.
❯ cargo test
Compiling git2 v0.6.0 (file:///.../git2-rs)
error: borrowed value does not live long enough
--> src/config.rs:560:23
|
560 | for entry in &cfg.entries(None).unwrap() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value created here
...
564 | }
| - temporary value only lives until here
565 | println!("{:?}", values);
566 | }
| - temporary value needs to live until here
|
= note: consider using a `let` binding to increase its lifetime
error: `entry` does not live long enough
--> src/config.rs:564:9
|
562 | let value = entry.value().unwrap();
| ----- borrow occurs here
563 | values.push(value.clone());
564 | }
| ^ `entry` dropped here while still borrowed
565 | println!("{:?}", values);
566 | }
| - borrowed value needs to live until here
error: aborting due to 2 previous errors
Build failed, waiting for other jobs to finish...
error: Could not compile `git2`.
To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment