7 fn new(s: &str) -> CrateId {
8 CrateId { local_path: s.to_string(), junk: "wutevs".to_string() }
12 pub fn remove_package_from_database() {
13 let mut lines_to_use: Vec<&CrateId> = Vec::new();
14 //~^ NOTE `lines_to_use` declared here, outside of the closure body
15 let push_id = |installed_id: &CrateId| {
16 //~^ NOTE `installed_id` is a reference that is only valid in the closure body
17 lines_to_use.push(installed_id);
18 //~^ ERROR borrowed data escapes outside of closure
19 //~| NOTE `installed_id` escapes the closure body here
21 list_database(push_id);
23 for l in &lines_to_use {
24 println!("{}", l.local_path);
28 pub fn list_database<F>(mut f: F)
32 let stuff = ["foo", "bar"];
40 remove_package_from_database();