blob: 9db9cfc7ff0244c8bc81bc09da01b2cc6cc86c22 (
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
|
error[E0425]: cannot find value `x` in this scope
--> $DIR/ruby_style_closure.rs:13:14
|
LL | Some(x * 2)
| ^ not found in this scope
error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
--> $DIR/ruby_style_closure.rs:10:31
|
LL | let p = Some(45).and_then({
| ______________________--------_^
| | |
| | required by a bound introduced by this call
LL | |
LL | | |x| println!("doubling {}", x);
LL | | Some(x * 2)
| | -----------
LL | |
LL | | });
| |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
|
= help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
note: required by a bound in `Option::<T>::and_then`
--> $SRC_DIR/core/src/option.rs:LL:COL
|
LL | F: ~const FnOnce(T) -> Option<U>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::and_then`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0425.
For more information about an error, try `rustc --explain E0277`.
|