blob: 70606a2a200de3a090e07986a8c219ab462677b3 (
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());
}
|