7 fn new(s: &str) -> CrateId {
9 local_path: s.to_string(),
10 junk: "wutevs".to_string()
15 pub fn remove_package_from_database() {
16 let mut lines_to_use: Vec<&CrateId> = Vec::new();
17 //~^ NOTE cannot infer an appropriate lifetime
18 let push_id = |installed_id: &CrateId| {
19 //~^ NOTE borrowed data cannot outlive this closure
20 //~| NOTE ...so that variable is valid at time of its declaration
21 lines_to_use.push(installed_id);
22 //~^ ERROR borrowed data cannot be stored outside of its closure
23 //~| NOTE cannot be stored outside of its closure
25 list_database(push_id);
27 for l in &lines_to_use {
28 println!("{}", l.local_path);
33 pub fn list_database<F>(mut f: F) where F: FnMut(&CrateId) {
34 let stuff = ["foo", "bar"];
42 remove_package_from_database();