2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
|
|
|
|
2014-09-14 20:27:36 -07:00
|
|
|
fn f<T>(x: Vec<T>) -> T { return x.into_iter().next().unwrap(); }
|
2011-07-08 14:28:46 +02:00
|
|
|
|
2016-10-29 22:54:04 +01:00
|
|
|
fn g<F>(act: F) -> isize where F: FnOnce(Vec<isize>) -> isize { return act(vec![1, 2, 3]); }
|
2011-07-08 14:28:46 +02:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(g(f), 1);
|
2015-01-02 17:32:54 -05:00
|
|
|
let f1 = f;
|
2014-05-25 03:17:19 -07:00
|
|
|
assert_eq!(f1(vec!["x".to_string(), "y".to_string(), "z".to_string()]),
|
|
|
|
"x".to_string());
|
2011-07-18 08:41:35 -07:00
|
|
|
}
|