Skip to content

Instantly share code, notes, and snippets.

@mysteriouspants
Created January 11, 2017 05:49
Show Gist options
  • Save mysteriouspants/67b497be7b13b5fe67f01ddf66bab7d8 to your computer and use it in GitHub Desktop.
Save mysteriouspants/67b497be7b13b5fe67f01ddf66bab7d8 to your computer and use it in GitHub Desktop.
error: borrowed value does not live long enough
--> src\main.rs:80:29
|
80 | current_dir().unwrap().as_path()
| ^^^^^^^^^^^^^^^^^^^^^^ temporary value created here
81 | };
| - temporary value only lives until here
...
92 | }
| - temporary value needs to live until here
let working_directory = if matches.is_present("root") {
Path::new(matches.value_of("root").unwrap())
} else {
current_dir().unwrap().as_path()
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment