fn g[X](X x) -> X { ret x; } fn f[T](T t) -> tup(T,T) { type pair = tup(T,T); let pair x = tup(t,t); ret g[pair](x); } fn main() { auto b = f[int](10); log b._0; log b._1; check (b._0 == 10); check (b._1 == 10); } fn g[X](&X x) -> X { ret x; } fn f[T](&T t) -> tup(T,T) { type pair = tup(T,T); let pair x = tup(t,t); ret g[pair](x); } fn main() { auto b = f[int](10); log b._0; log b._1; check (b._0 == 10); check (b._1 == 10); } fn g[X](&X x) -> X { ret x; } fn f[T](&T t) -> tup(T,T) { type pair = tup(T,T); let pair x = tup(t,t); ret g[pair](x); } fn main() { auto b = f[int](10); log b._0; log b._1; assert (b._0 == 10); assert (b._1 == 10); } fn g[X](&X x) -> X { ret x; } fn f[T](&T t) -> tup(T,T) { type pair = tup(T,T); let pair x = tup(t,t); ret g[pair](x); } fn main() { auto b = f[int](10); log b._0; log b._1; check (b._0 == 10); check (b._1 == 10); } fn g[X](&X x) -> X { ret x; } fn f[T](&T t) -> tup(T,T) { type pair = tup(T,T); let pair x = tup(t,t); ret g[pair](x); } fn main() { auto b = f[int](10); log b._0; log b._1; assert (b._0 == 10); assert (b._1 == 10); } fn g[X](&X x) -> X { ret x; } fn f[T](&T t) -> tup(T, T) { type pair = tup(T, T); let pair x = tup(t, t); ret g[pair](x); } fn main() { auto b = f[int](10); log b._0; log b._1; assert (b._0 == 10); assert (b._1 == 10); } fn g[X](&X x) -> X { ret x; } fn f[T](&T t) -> rec(T a, T b) { type pair = rec(T a, T b); let pair x = rec(a=t, b=t); ret g[pair](x); } fn main() { auto b = f[int](10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g[X](x: &X) -> X { ret x; } fn f[T](t: &T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g[pair](x); } fn main() { let b = f[int](10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g<X>(x: &X) -> X { ret x; } fn f<T>(t: &T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g[pair](x); } fn main() { let b = f[int](10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g<X>(x: &X) -> X { ret x; } fn f<T>(t: &T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g<@X>(x: &X) -> X { ret x; } fn f<@T>(t: &T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g<@X>(x: X) -> X { ret x; } fn f<@T>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g<X>(x: X) -> X { ret x; } fn f<T>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g<copy X>(x: X) -> X { ret x; } fn f<copy T>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log b.a; log b.b; assert (b.a == 10); assert (b.b == 10); } fn g<copy X>(x: X) -> X { ret x; } fn f<copy T>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log_full(core::debug, b.a); log_full(core::debug, b.b); assert (b.a == 10); assert (b.b == 10); } fn g<copy X>(x: X) -> X { ret x; } fn f<copy T>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } fn g<X: copy>(x: X) -> X { ret x; } fn f<T: copy>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; ret g::<pair>(x); } fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } fn g<X: copy>(x: X) -> X { return x; } fn f<T: copy>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; return g::<pair>(x); } fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } fn g<X: Copy>(x: X) -> X { return x; } fn f<T: Copy>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; return g::<pair>(x); } fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X: Copy>(x: X) -> X { return x; } fn f<T: Copy>(t: T) -> {a: T, b: T} { type pair = {a: T, b: T}; let x: pair = {a: t, b: t}; return g::<pair>(x); } fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X: Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T: Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t, b: t}; return g::<Pair<T>>(x); } fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X: Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T: Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X:Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T:Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); assert (b.a == 10); assert (b.b == 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X:Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T:Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); log(debug, b.a); log(debug, b.b); fail_unless!((b.a == 10)); fail_unless!((b.b == 10)); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X:Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T:Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); debug!(b.a); debug!(b.b); fail_unless!((b.a == 10)); fail_unless!((b.b == 10)); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X:Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T:Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); debug!(b.a); debug!(b.b); assert!((b.a == 10)); assert!((b.b == 10)); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X:Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T:Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); debug!(b.a); debug!(b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X:Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T:Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: copy t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); debug!(b.a); debug!(b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X:Copy>(x: X) -> X { return x; } struct Pair<T> {a: T, b: T} fn f<T:Copy>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: copy t, b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); info!(b.a); info!(b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X>(x: X) -> X { return x; } #[deriving(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); info!(b.a); info!(b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X>(x: X) -> X { return x; } #[deriving(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); info2!("{:?}" ,b.a); info2!("{:?}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X>(x: X) -> X { return x; } #[deriving(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); info!("{:?}" ,b.a); info!("{:?}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X>(x: X) -> X { return x; } #[deriving(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); println!("{:?}" ,b.a); println!("{:?}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. extern crate debug; fn g<X>(x: X) -> X { return x; } #[deriving(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); println!("{:?}" ,b.a); println!("{:?}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X>(x: X) -> X { return x; } #[deriving(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); println!("{}" ,b.a); println!("{}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X>(x: X) -> X { return x; } #[derive(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<int>(10); println!("{}" ,b.a); println!("{}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); } // 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 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. fn g<X>(x: X) -> X { return x; } #[derive(Clone)] struct Pair<T> { a: T, b: T } fn f<T:Clone>(t: T) -> Pair<T> { let x: Pair<T> = Pair {a: t.clone(), b: t}; return g::<Pair<T>>(x); } pub fn main() { let b = f::<isize>(10); println!("{}" ,b.a); println!("{}", b.b); assert_eq!(b.a, 10); assert_eq!(b.b, 10); }