1 struct PrintOnDrop<'a>(&'a str);
3 impl Drop for PrintOnDrop<'_> {
5 println!("printint: {}", self.0);
9 use std::collections::BTreeMap;
10 use std::iter::FromIterator;
13 let s = String::from("Hello World!");
14 let _map = BTreeMap::from_iter([((), PrintOnDrop(&s))]);
15 drop(s); //~ ERROR cannot move out of `s` because it is borrowed