// Copyright 2012 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. // xfail-fast pub fn main() { test05(); } struct Pair { a: A, b: B } fn make_generic_record(a: A, b: B) -> Pair { return Pair {a: a, b: b}; } fn test05_start(f: &~fn(v: float, v: ~str) -> Pair) { let p = (*f)(22.22f, ~"Hi"); log(debug, copy p); assert p.a == 22.22f; assert p.b == ~"Hi"; let q = (*f)(44.44f, ~"Ho"); log(debug, copy q); assert q.a == 44.44f; assert q.b == ~"Ho"; } fn spawn(f: extern fn(&~fn(A,B)->Pair)) { let arg = fn~(a: A, b: B) -> Pair { return make_generic_record(a, b); }; task::spawn(|| f(&arg) ); } fn test05() { spawn::(test05_start); }