fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.1 KiB73 linesraw
1error[E0106]: missing lifetime specifier
2  --> $DIR/issue-26638.rs:1:62
3   |
4LL | 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
8help: consider introducing a named lifetime parameter
9   |
10LL | fn parse_type<'a>(iter: Box<dyn Iterator<Item=&'a str>+'static>) -> &'a str { iter.next() }
11   |              ++++                              ++                    ++
12
13error[E0106]: missing lifetime specifier
14  --> $DIR/issue-26638.rs:5:40
15   |
16LL | 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
20help: consider using the `'static` lifetime
21   |
22LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &'static str { iter() }
23   |                                         +++++++
24
25error[E0106]: missing lifetime specifier
26  --> $DIR/issue-26638.rs:10:22
27   |
28LL | fn parse_type_3() -> &str { unimplemented!() }
29   |                      ^ expected named lifetime parameter
30   |
31   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
32help: consider using the `'static` lifetime
33   |
34LL | fn parse_type_3() -> &'static str { unimplemented!() }
35   |                       +++++++
36
37error[E0308]: mismatched types
38  --> $DIR/issue-26638.rs:1:69
39   |
40LL | fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next() }
41   |                                                              ----   ^^^^^^^^^^^ expected `&str`, found `Option<&str>`
42   |                                                              |
43   |                                                              expected `&str` because of return type
44   |
45   = note: expected reference `&str`
46                   found enum `Option<&str>`
47
48error[E0061]: this function takes 1 argument but 0 arguments were supplied
49  --> $DIR/issue-26638.rs:5:47
50   |
51LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
52   |                                               ^^^^-- an argument of type `&u8` is missing
53   |
54help: provide the argument
55   |
56LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) }
57   |                                                   ~~~~~~~~~~~
58
59error[E0308]: mismatched types
60  --> $DIR/issue-26638.rs:5:47
61   |
62LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
63   |                                        ----   ^^^^^^ expected `&str`, found `&u8`
64   |                                        |
65   |                                        expected `&'static str` because of return type
66   |
67   = note: expected reference `&'static str`
68              found reference `&u8`
69
70error: aborting due to 6 previous errors
71
72Some errors have detailed explanations: E0061, E0106, E0308.
73For more information about an error, try `rustc --explain E0061`.