summaryrefslogtreecommitdiffstats
path: root/tests/ui/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs
blob: 6834c392d4e96634a8791cf071857fec2e9a3925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-pass
#![allow(dead_code)]
// pretty-expanded FIXME #23616

// Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) +
// 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would
// cause a compilation error. Issue #18772.

fn adder(y: isize) -> Box<dyn Fn(isize) -> isize + 'static> {
    Box::new(move |x| y + x)
}

fn main() {}