// -*- rust -*- fn id[T](T x) -> T { ret x; } type triple = tup(int,int,int); fn main() { auto x = 62; auto y = 63; auto a = 'a'; auto b = 'b'; let triple p = tup(65, 66, 67); let triple q = tup(68, 69, 70); y = id[int](x); log y; check (x == y); b = id[char](a); log b; check (a == b); q = id[triple](p); x = p._2; y = q._2; log y; check (x == y); } // -*- rust -*- fn id[T](&T x) -> T { ret x; } type triple = tup(int,int,int); fn main() { auto x = 62; auto y = 63; auto a = 'a'; auto b = 'b'; let triple p = tup(65, 66, 67); let triple q = tup(68, 69, 70); y = id[int](x); log y; check (x == y); b = id[char](a); log b; check (a == b); q = id[triple](p); x = p._2; y = q._2; log y; check (x == y); } // -*- rust -*- fn id[T](&T x) -> T { ret x; } type triple = tup(int,int,int); fn main() { auto x = 62; auto y = 63; auto a = 'a'; auto b = 'b'; let triple p = tup(65, 66, 67); let triple q = tup(68, 69, 70); y = id[int](x); log y; assert (x == y); b = id[char](a); log b; assert (a == b); q = id[triple](p); x = p._2; y = q._2; log y; assert (x == y); } // -*- rust -*- fn id[T](&T x) -> T { ret x; } type triple = tup(int,int,int); fn main() { auto x = 62; auto y = 63; auto a = 'a'; auto b = 'b'; let triple p = tup(65, 66, 67); let triple q = tup(68, 69, 70); y = id[int](x); log y; check (x == y); b = id[char](a); log b; check (a == b); q = id[triple](p); x = p._2; y = q._2; log y; check (x == y); } // -*- rust -*- fn id[T](&T x) -> T { ret x; } type triple = tup(int,int,int); fn main() { auto x = 62; auto y = 63; auto a = 'a'; auto b = 'b'; let triple p = tup(65, 66, 67); let triple q = tup(68, 69, 70); y = id[int](x); log y; assert (x == y); b = id[char](a); log b; assert (a == b); q = id[triple](p); x = p._2; y = q._2; log y; assert (x == y); } // -*- rust -*- fn id[T](&T x) -> T { ret x; } type triple = tup(int, int, int); fn main() { auto x = 62; auto y = 63; auto a = 'a'; auto b = 'b'; let triple p = tup(65, 66, 67); let triple q = tup(68, 69, 70); y = id[int](x); log y; assert (x == y); b = id[char](a); log b; assert (a == b); q = id[triple](p); x = p._2; y = q._2; log y; assert (x == y); } // -*- rust -*- fn id[T](&T x) -> T { ret x; } type triple = rec(int x, int y, int z); fn main() { auto x = 62; auto y = 63; auto a = 'a'; auto b = 'b'; let triple p = rec(x=65, y=66, z=67); let triple q = rec(x=68, y=69, z=70); y = id[int](x); log y; assert (x == y); b = id[char](a); log b; assert (a == b); q = id[triple](p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id[T](x: &T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id[int](x); log y; assert (x == y); b = id[char](a); log b; assert (a == b); q = id[triple](p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id<T>(x: &T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id[int](x); log y; assert (x == y); b = id[char](a); log b; assert (a == b); q = id[triple](p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id<T>(x: &T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log y; assert (x == y); b = id::<char>(a); log b; assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id<@T>(x: &T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log y; assert (x == y); b = id::<char>(a); log b; assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id<@T>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log y; assert (x == y); b = id::<char>(a); log b; assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id<T>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log y; assert (x == y); b = id::<char>(a); log b; assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id<copy T>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log y; assert (x == y); b = id::<char>(a); log b; assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log y; assert (x == y); } // -*- rust -*- fn id<copy T>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log_full(core::debug, y); assert (x == y); b = id::<char>(a); log_full(core::debug, b); assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log_full(core::debug, y); assert (x == y); } // -*- rust -*- fn id<copy T>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // -*- rust -*- fn id<T: copy>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let x = 62; let y = 63; let a = 'a'; let b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // -*- rust -*- fn id<T: copy>(x: T) -> T { ret x; } type triple = {x: int, y: int, z: int}; fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let mut q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // -*- rust -*- fn id<T: copy>(x: T) -> T { return x; } type triple = {x: int, y: int, z: int}; fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let mut q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // -*- rust -*- fn id<T: Copy>(x: T) -> T { return x; } type triple = {x: int, y: int, z: int}; fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let mut q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // 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. // -*- rust -*- fn id<T: Copy>(x: T) -> T { return x; } type triple = {x: int, y: int, z: int}; fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: triple = {x: 65, y: 66, z: 67}; let mut q: triple = {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // 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. // -*- rust -*- fn id<T: Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<Triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // 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. // -*- rust -*- fn id<T: Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<Triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // 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. // -*- rust -*- fn id<T:Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); assert (x == y); b = id::<char>(a); log(debug, b); assert (a == b); q = id::<Triple>(p); x = p.z; y = q.z; log(debug, y); assert (x == y); } // 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. // -*- rust -*- fn id<T:Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); log(debug, y); fail_unless!((x == y)); b = id::<char>(a); log(debug, b); fail_unless!((a == b)); q = id::<Triple>(p); x = p.z; y = q.z; log(debug, y); fail_unless!((x == y)); } // 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. // -*- rust -*- fn id<T:Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); debug!(y); fail_unless!((x == y)); b = id::<char>(a); debug!(b); fail_unless!((a == b)); q = id::<Triple>(p); x = p.z; y = q.z; debug!(y); fail_unless!((x == y)); } // 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. // -*- rust -*- fn id<T:Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); debug!(y); assert!((x == y)); b = id::<char>(a); debug!(b); assert!((a == b)); q = id::<Triple>(p); x = p.z; y = q.z; debug!(y); assert!((x == y)); } // 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. // -*- rust -*- fn id<T:Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); debug!(y); assert_eq!(x, y); b = id::<char>(a); debug!(b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; debug!(y); assert_eq!(x, y); } // 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. // -*- rust -*- fn id<T:Copy>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); info!(y); assert_eq!(x, y); b = id::<char>(a); info!(b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; info!(y); assert_eq!(x, y); } // 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. // -*- rust -*- fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); info!(y); assert_eq!(x, y); b = id::<char>(a); info!(b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; info!(y); assert_eq!(x, y); } // 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. #[allow(dead_assignment)]; // -*- rust -*- fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); info!(y); assert_eq!(x, y); b = id::<char>(a); info!(b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; info!(y); assert_eq!(x, y); } // 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. #[allow(dead_assignment)]; // -*- rust -*- fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); info2!("{}", y); assert_eq!(x, y); b = id::<char>(a); info2!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; info2!("{}", y); assert_eq!(x, y); } // 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. #[allow(dead_assignment)]; // -*- rust -*- fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); info!("{}", y); assert_eq!(x, y); b = id::<char>(a); info!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; info!("{}", y); assert_eq!(x, y); } // 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. #[allow(dead_assignment)]; fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); info!("{}", y); assert_eq!(x, y); b = id::<char>(a); info!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; info!("{}", y); assert_eq!(x, y); } // 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. #[allow(dead_assignment)]; fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); println!("{}", y); assert_eq!(x, y); b = id::<char>(a); println!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; println!("{}", y); assert_eq!(x, y); } // 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. #![allow(dead_assignment)] fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); println!("{}", y); assert_eq!(x, y); b = id::<char>(a); println!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; println!("{}", y); assert_eq!(x, y); } // 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. #![allow(dead_assignment)] fn id<T>(x: T) -> T { return x; } struct Triple {x: int, y: int, z: int} impl Copy for Triple {} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); println!("{}", y); assert_eq!(x, y); b = id::<char>(a); println!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; println!("{}", y); assert_eq!(x, y); } // 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. #![allow(dead_assignment)] fn id<T>(x: T) -> T { return x; } #[derive(Copy)] struct Triple {x: int, y: int, z: int} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<int>(x); println!("{}", y); assert_eq!(x, y); b = id::<char>(a); println!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; println!("{}", y); assert_eq!(x, y); } // 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. #![allow(dead_assignment)] fn id<T>(x: T) -> T { return x; } #[derive(Copy)] struct Triple {x: isize, y: isize, z: isize} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<isize>(x); println!("{}", y); assert_eq!(x, y); b = id::<char>(a); println!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; println!("{}", y); assert_eq!(x, y); } // 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. #![allow(dead_assignment)] fn id<T>(x: T) -> T { return x; } #[derive(Copy, Clone)] struct Triple {x: isize, y: isize, z: isize} pub fn main() { let mut x = 62; let mut y = 63; let a = 'a'; let mut b = 'b'; let p: Triple = Triple {x: 65, y: 66, z: 67}; let mut q: Triple = Triple {x: 68, y: 69, z: 70}; y = id::<isize>(x); println!("{}", y); assert_eq!(x, y); b = id::<char>(a); println!("{}", b); assert_eq!(a, b); q = id::<Triple>(p); x = p.z; y = q.z; println!("{}", y); assert_eq!(x, y); }