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