rust/tests/ui/traits/next-solver/closure-inference-guidance.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
224 B
Rust
Raw Normal View History

2023-12-14 06:11:28 -06:00
// compile-flags: -Znext-solver
// check-pass
fn foo(i: isize) -> isize { i + 1 }
fn apply<A, F>(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) }
pub fn main() {
let f = |i| foo(i);
assert_eq!(apply(f, 2), 3);
}