]> git.proxmox.com Git - rustc.git/blob - tests/ui/lifetimes/issue-26638.stderr
New upstream version 1.76.0+dfsg1
[rustc.git] / tests / ui / lifetimes / issue-26638.stderr
1 error[E0106]: missing lifetime specifier
2 --> $DIR/issue-26638.rs:1:62
3 |
4 LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next() }
5 | ------------------------------------ ^ expected named lifetime parameter
6 |
7 = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from
8 help: consider introducing a named lifetime parameter
9 |
10 LL | fn parse_type<'a>(iter: Box<dyn Iterator<Item=&'a str>+'static>) -> &'a str { iter.next() }
11 | ++++ ++ ++
12
13 error[E0106]: missing lifetime specifier
14 --> $DIR/issue-26638.rs:5:40
15 |
16 LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
17 | ^ expected named lifetime parameter
18 |
19 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
20 help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
21 |
22 LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &'static str { iter() }
23 | +++++++
24 help: instead, you are more likely to want to change the argument to be borrowed...
25 |
26 LL | fn parse_type_2(iter: &fn(&u8)->&u8) -> &str { iter() }
27 | +
28 help: ...or alternatively, you might want to return an owned value
29 |
30 LL | fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() }
31 | ~~~~~~
32
33 error[E0106]: missing lifetime specifier
34 --> $DIR/issue-26638.rs:10:22
35 |
36 LL | fn parse_type_3() -> &str { unimplemented!() }
37 | ^ expected named lifetime parameter
38 |
39 = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
40 help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
41 |
42 LL | fn parse_type_3() -> &'static str { unimplemented!() }
43 | +++++++
44 help: instead, you are more likely to want to return an owned value
45 |
46 LL | fn parse_type_3() -> String { unimplemented!() }
47 | ~~~~~~
48
49 error[E0308]: mismatched types
50 --> $DIR/issue-26638.rs:1:69
51 |
52 LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next() }
53 | ---- ^^^^^^^^^^^ expected `&str`, found `Option<&str>`
54 | |
55 | expected `&str` because of return type
56 |
57 = note: expected reference `&str`
58 found enum `Option<&str>`
59 help: consider using `Option::expect` to unwrap the `Option<&str>` value, panicking if the value is an `Option::None`
60 |
61 LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next().expect("REASON") }
62 | +++++++++++++++++
63
64 error[E0061]: this function takes 1 argument but 0 arguments were supplied
65 --> $DIR/issue-26638.rs:5:47
66 |
67 LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
68 | ^^^^-- an argument of type `&u8` is missing
69 |
70 help: provide the argument
71 |
72 LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) }
73 | ~~~~~~~~~~~
74
75 error[E0308]: mismatched types
76 --> $DIR/issue-26638.rs:5:47
77 |
78 LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
79 | ---- ^^^^^^ expected `&str`, found `&u8`
80 | |
81 | expected `&'static str` because of return type
82 |
83 = note: expected reference `&'static str`
84 found reference `&u8`
85
86 error: aborting due to 6 previous errors
87
88 Some errors have detailed explanations: E0061, E0106, E0308.
89 For more information about an error, try `rustc --explain E0061`.