summaryrefslogtreecommitdiffstats
path: root/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/expr/malformed_closure/ruby_style_closure.stderr')
-rw-r--r--src/test/ui/expr/malformed_closure/ruby_style_closure.stderr32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
new file mode 100644
index 000000000..9db9cfc7f
--- /dev/null
+++ b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
@@ -0,0 +1,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`.