// -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { check (p.z == 12); p.z = 13; check (p.z == 13); } fn main() { let point a = rec(x=10, y=11, z=mutable 12); let @point b = a; check (b.z == 12); f(b); check (a.z == 12); check (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { check (p.z == 12); p.z = 13; check (p.z == 13); } fn main() { let point a = rec(x=10, y=11, z=mutable 12); let @point b = @a; check (b.z == 12); f(b); check (a.z == 12); check (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { check (p.z == 12); p.z = 13; check (p.z == 13); } fn main() { let point a = rec(x=10, y=11, mutable z=12); let @point b = @a; check (b.z == 12); f(b); check (a.z == 12); check (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); impure fn f(@point p) { check (p.z == 12); p.z = 13; check (p.z == 13); } impure fn main() { let point a = rec(x=10, y=11, mutable z=12); let @point b = @a; check (b.z == 12); f(b); check (a.z == 12); check (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { check (p.z == 12); p.z = 13; check (p.z == 13); } fn main() { let point a = rec(x=10, y=11, mutable z=12); let @point b = @a; check (b.z == 12); f(b); check (a.z == 12); check (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let point a = rec(x=10, y=11, mutable z=12); let @point b = @a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { check (p.z == 12); p.z = 13; check (p.z == 13); } fn main() { let point a = rec(x=10, y=11, mutable z=12); let @point b = @a; check (b.z == 12); f(b); check (a.z == 12); check (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let point a = rec(x=10, y=11, mutable z=12); let @point b = @a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // -*- rust -*- type point = rec(int x, int y, mutable int z); fn f(@point p) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let point a = rec(x=10, y=11, mutable z=12); let @point b = @a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // -*- rust -*- type point = {x: int, y: int, mutable z: int}; fn f(p: @point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let a: point = {x: 10, y: 11, mutable z: 12}; let b: @point = @a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // -*- rust -*- type point = {x: int, y: int, mutable z: int}; fn f(p: @point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let a: point = {x: 10, y: 11, mutable z: 12}; let b: @point = @a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // -*- rust -*- type point = {x: int, y: int, mut z: int}; fn f(p: @point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let a: point = {x: 10, y: 11, mut z: 12}; let b: @point = @a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // -*- rust -*- type point = {x: int, y: int, mut z: int}; fn f(p: @point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let a: point = {x: 10, y: 11, mut z: 12}; let b: @point = @copy a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // 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 -*- type point = {x: int, y: int, mut z: int}; fn f(p: @point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let a: point = {x: 10, y: 11, mut z: 12}; let b: @point = @copy a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // 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 -*- struct Point {x: int, y: int, mut z: int} fn f(p: @Point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } fn main() { let a: Point = Point {x: 10, y: 11, mut z: 12}; let b: @Point = @copy a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // 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 -*- struct Point {x: int, y: int, mut z: int} fn f(p: @Point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } pub fn main() { let a: Point = Point {x: 10, y: 11, mut z: 12}; let b: @Point = @copy a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // 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 -*- struct Point {x: int, y: int, z: int} fn f(p: @mut Point) { assert (p.z == 12); p.z = 13; assert (p.z == 13); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @mut Point = @mut copy a; assert (b.z == 12); f(b); assert (a.z == 12); assert (b.z == 13); } // 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 -*- struct Point {x: int, y: int, z: int} fn f(p: @mut Point) { fail_unless!((p.z == 12)); p.z = 13; fail_unless!((p.z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @mut Point = @mut copy a; fail_unless!((b.z == 12)); f(b); fail_unless!((a.z == 12)); fail_unless!((b.z == 13)); } // 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 -*- struct Point {x: int, y: int, z: int} fn f(p: @mut Point) { assert!((p.z == 12)); p.z = 13; assert!((p.z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @mut Point = @mut copy a; assert!((b.z == 12)); f(b); assert!((a.z == 12)); assert!((b.z == 13)); } // 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 -*- struct Point {x: int, y: int, z: int} fn f(p: @mut Point) { assert!((p.z == 12)); p.z = 13; assert!((p.z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @mut Point = @mut copy a; assert_eq!(b.z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.z, 13); } // 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 -*- struct Point {x: int, y: int, z: int} fn f(p: @mut Point) { assert!((p.z == 12)); p.z = 13; assert!((p.z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @mut Point = @mut a; assert_eq!(b.z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.z, 13); } // 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. #[feature(managed_boxes)]; struct Point {x: int, y: int, z: int} fn f(p: @mut Point) { assert!((p.z == 12)); p.z = 13; assert!((p.z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @mut Point = @mut a; assert_eq!(b.z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.z, 13); } // 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. #[feature(managed_boxes)]; use std::cell::Cell; struct Point {x: int, y: int, z: int} fn f(p: @Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @Cell<Point> = @Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. #![feature(managed_boxes)] use std::cell::Cell; struct Point {x: int, y: int, z: int} fn f(p: @Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: @Cell<Point> = @Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. #![feature(managed_boxes)] use std::cell::Cell; use std::gc::{Gc, GC}; struct Point {x: int, y: int, z: int} fn f(p: Gc<Cell<Point>>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: Gc<Cell<Point>> = box(GC) Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. use std::cell::Cell; use std::gc::{Gc, GC}; struct Point {x: int, y: int, z: int} fn f(p: Gc<Cell<Point>>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: Gc<Cell<Point>> = box(GC) Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. use std::cell::Cell; struct Point {x: int, y: int, z: int} fn f(p: &Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: &Cell<Point> = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. use std::cell::Cell; struct Point {x: int, y: int, z: int} impl Copy for Point {} fn f(p: &Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: &Cell<Point> = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. use std::cell::Cell; #[derive(Copy)] struct Point {x: int, y: int, z: int} fn f(p: &Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: &Cell<Point> = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. // pretty-expanded FIXME #23616 use std::cell::Cell; #[derive(Copy)] struct Point {x: int, y: int, z: int} fn f(p: &Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: &Cell<Point> = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. // pretty-expanded FIXME #23616 use std::cell::Cell; #[derive(Copy)] struct Point {x: isize, y: isize, z: isize} fn f(p: &Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: &Cell<Point> = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. // pretty-expanded FIXME #23616 use std::cell::Cell; #[derive(Copy, Clone)] struct Point {x: isize, y: isize, z: isize} fn f(p: &Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: &Cell<Point> = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); } // 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. use std::cell::Cell; #[derive(Copy, Clone)] struct Point {x: isize, y: isize, z: isize} fn f(p: &Cell<Point>) { assert!((p.get().z == 12)); p.set(Point {x: 10, y: 11, z: 13}); assert!((p.get().z == 13)); } pub fn main() { let a: Point = Point {x: 10, y: 11, z: 12}; let b: &Cell<Point> = &Cell::new(a); assert_eq!(b.get().z, 12); f(b); assert_eq!(a.z, 12); assert_eq!(b.get().z, 13); }