]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-26619.rs
Auto merge of #59068 - ljedrz:kill_off_NodeId_stragglers, r=Zoxc
[rust.git] / src / test / ui / issues / issue-26619.rs
1 #![feature(slice_patterns)]
2
3 pub struct History<'a> { pub _s: &'a str }
4
5 impl<'a> History<'a> {
6     pub fn get_page(&self) {
7         for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) {
8             //~^ ERROR borrowed value does not live long enough
9             println!("{:?}", s);
10         }
11     }
12
13     fn make_entry(&self, s: &'a String) -> Option<&str> {
14         let parts: Vec<_> = s.split('|').collect();
15         println!("{:?} -> {:?}", s, parts);
16
17         if let [commit, ..] = &parts[..] { Some(commit) } else { None }
18     }
19 }
20
21 fn main() {
22     let h = History{ _s: "" };
23     h.get_page();
24 }