summaryrefslogtreecommitdiffstats
path: root/tests/ui/expr/malformed_closure/ruby_style_closure.rs
blob: fdec072b8a864cb5ed72195e4e429ca9449bf6b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Part of issue #27300.
// The problem here is that ruby-style closures are parsed as blocks whose
// first statement is a closure. See the issue for more details:
// https://github.com/rust-lang/rust/issues/27300

// Note: this test represents what the compiler currently emits. The error
// message will be improved later.

fn main() {
    let p = Some(45).and_then({
        |x| println!("doubling {}", x);
        Some(x * 2)
        //~^ ERROR: cannot find value `x` in this scope
    });
}