]> git.lizzy.rs Git - rust.git/blob - tests/ui/generics/autobind.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / generics / autobind.rs
1 // run-pass
2
3 fn f<T>(x: Vec<T>) -> T { return x.into_iter().next().unwrap(); }
4
5 fn g<F>(act: F) -> isize where F: FnOnce(Vec<isize>) -> isize { return act(vec![1, 2, 3]); }
6
7 pub fn main() {
8     assert_eq!(g(f), 1);
9     let f1 = f;
10     assert_eq!(f1(vec!["x".to_string(), "y".to_string(), "z".to_string()]),
11                "x".to_string());
12 }