// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn id(x: T) -> T { x } #[deriving(PartialEq, Show)] struct Foo(T); #[deriving(PartialEq, Show)] enum Bar { Bar(T) } pub fn main() { let f: |int| -> int = id; assert_eq!(f(5), 5); let f: proc(int) -> int = id; assert_eq!(f(5), 5); let f: |int| -> Foo = Foo; assert_eq!(f(5), Foo(5)); let f: proc(int) -> Foo = Foo; assert_eq!(f(5), Foo(5)); let f: |int| -> Bar = Bar; assert_eq!(f(5), Bar(5)); let f: proc(int) -> Bar = Bar; assert_eq!(f(5), Bar(5)); let f: |int| -> Option = Some; assert_eq!(f(5), Some(5)); let f: proc(int) -> Option = Some; assert_eq!(f(5), Some(5)); }