]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-26619.rs
New upstream version 1.42.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-26619.rs
1 pub struct History<'a> { pub _s: &'a str }
2
3 impl<'a> History<'a> {
4 pub fn get_page(&self) {
5 for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) {
6 //~^ ERROR cannot return value referencing function parameter
7 println!("{:?}", s);
8 }
9 }
10
11 fn make_entry(&self, s: &'a String) -> Option<&str> {
12 let parts: Vec<_> = s.split('|').collect();
13 println!("{:?} -> {:?}", s, parts);
14
15 if let [commit, ..] = &parts[..] { Some(commit) } else { None }
16 }
17 }
18
19 fn main() {
20 let h = History{ _s: "" };
21 h.get_page();
22 }