diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/generics/autobind.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/generics/autobind.rs b/src/test/ui/generics/autobind.rs new file mode 100644 index 000000000..70606a2a2 --- /dev/null +++ b/src/test/ui/generics/autobind.rs @@ -0,0 +1,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()); +} |