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