File: suggest-return-closure.stderr

package info (click to toggle)
rustc 1.87.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 925,564 kB
  • sloc: xml: 158,127; python: 36,039; javascript: 19,761; sh: 19,737; cpp: 18,981; ansic: 13,133; asm: 4,376; makefile: 710; perl: 29; lisp: 28; ruby: 19; sql: 11
file content (64 lines) | stat: -rw-r--r-- 2,279 bytes parent folder | download | duplicates (7)
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
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
   |                 help: replace with an appropriate return type: `impl FnOnce()`
   |
   = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html

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
   |                help: replace with an appropriate return type: `impl FnMut(char)`
   |
   = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html

error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
  --> $DIR/suggest-return-closure.rs:32:13
   |
LL | fn fun() -> _ {
   |             ^
   |             |
   |             not allowed in type signatures
   |             help: replace with an appropriate return type: `impl Fn() -> i32`
   |
   = note: for more information on `Fn` traits and closure types, see https://doc.rust-lang.org/book/ch13-01-closures.html

error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
  --> $DIR/suggest-return-closure.rs:23: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:23: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`.