]> git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/lub-match.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / nll / lub-match.rs
1 // Test that we correctly consider the type of `match` to be the LUB
2 // of the various arms, particularly in the case where regions are
3 // involved.
4
5 pub fn opt_str0<'a>(maybestr: &'a Option<String>) -> &'a str {
6 match *maybestr {
7 Some(ref s) => {
8 let s: &'a str = s;
9 s
10 }
11 None => "(none)",
12 }
13 }
14
15 pub fn opt_str1<'a>(maybestr: &'a Option<String>) -> &'a str {
16 match *maybestr {
17 None => "(none)",
18 Some(ref s) => {
19 let s: &'a str = s;
20 s
21 }
22 }
23 }
24
25 pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
26 match *maybestr {
27 None => "(none)",
28 Some(ref s) => {
29 let s: &'a str = s;
30 s
31 //~^ ERROR lifetime may not live long enough
32 }
33 }
34 }
35
36 pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
37 match *maybestr {
38 Some(ref s) => {
39 let s: &'a str = s;
40 s
41 //~^ ERROR lifetime may not live long enough
42 }
43 None => "(none)",
44 }
45 }
46
47 fn main() {}