]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-glb-free-free.rs
Auto merge of #60093 - GuillaumeGomez:fix-attrs-pos, r=Manishearth
[rust.git] / src / test / ui / regions / regions-glb-free-free.rs
1 mod argparse {
2     pub struct Flag<'a> {
3         name: &'a str,
4         pub desc: &'a str,
5         max_count: usize,
6         value: usize
7     }
8
9     pub fn flag<'r>(name: &'r str, desc: &'r str) -> Flag<'r> {
10         Flag { name: name, desc: desc, max_count: 1, value: 0 }
11     }
12
13     impl<'a> Flag<'a> {
14         pub fn set_desc(self, s: &str) -> Flag<'a> {
15             Flag { //~ ERROR explicit lifetime required in the type of `s` [E0621]
16                 name: self.name,
17                 desc: s,
18                 max_count: self.max_count,
19                 value: self.value
20             }
21         }
22     }
23 }
24
25 fn main () {
26     let f : argparse::Flag = argparse::flag("flag", "My flag");
27     let updated_flag = f.set_desc("My new flag");
28     assert_eq!(updated_flag.desc, "My new flag");
29 }