blob: 7b691f0b69c8049abe5dc9fadb0d78ef39713fa2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
//@ run-pass
fn f<T>(x: Vec<T>) -> T { return x.into_iter().next().unwrap(); }
fn g<F>(act: F) -> isize where F: FnOnce(Vec<isize>) -> isize { return act(vec![1, 2, 3]); }
pub fn main() {
assert_eq!(g(f), 1);
let f1 = f;
assert_eq!(f1(vec!["x".to_string(), "y".to_string(), "z".to_string()]),
"x".to_string());
}
|