blob: 0639c23c75ade4df1b7df2bc7e7c2ca4918570ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/suggest-return-closure.rs:1:17
|
LL | fn fn_once() -> _ {
| ^ not allowed in type signatures
|
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
help: replace with an appropriate return type
|
LL - fn fn_once() -> _ {
LL + fn fn_once() -> impl FnOnce() {
|
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/suggest-return-closure.rs:13:16
|
LL | fn fn_mut() -> _ {
| ^ not allowed in type signatures
|
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
help: replace with an appropriate return type
|
LL - fn fn_mut() -> _ {
LL + fn fn_mut() -> impl FnMut(char) {
|
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> $DIR/suggest-return-closure.rs:33:13
|
LL | fn fun() -> _ {
| ^ not allowed in type signatures
|
= note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html
help: replace with an appropriate return type
|
LL - fn fun() -> _ {
LL + fn fun() -> impl Fn() -> i32 {
|
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
--> $DIR/suggest-return-closure.rs:24:9
|
LL | x.push(c);
| ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
LL | let mut x = String::new();
| +++
error[E0597]: `x` does not live long enough
--> $DIR/suggest-return-closure.rs:24:9
|
LL | let x = String::new();
| - binding `x` declared here
...
LL | |c| {
| --- value captured here
LL | x.push(c);
| ^ borrowed value does not live long enough
...
LL | }
| -- borrow later used here
| |
| `x` dropped here while still borrowed
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0121, E0596, E0597.
For more information about an error, try `rustc --explain E0121`.
|