]> git.lizzy.rs Git - rust.git/commitdiff
testsuite: Eliminate uses of structural records from most run-pass tests
authorTim Chevalier <chevalier@alum.wellesley.edu>
Sat, 26 Jan 2013 06:46:32 +0000 (22:46 -0800)
committerTim Chevalier <chevalier@alum.wellesley.edu>
Sat, 26 Jan 2013 19:35:17 +0000 (11:35 -0800)
Except the pipes tests (that needs a snapshot)

119 files changed:
src/test/auxiliary/cci_nested_lib.rs
src/test/auxiliary/crateresolve5-1.rs
src/test/auxiliary/crateresolve5-2.rs
src/test/run-pass/alias-uninit-value.rs
src/test/run-pass/alignment-gep-tup-like-2.rs
src/test/run-pass/alloca-from-derived-tydesc.rs
src/test/run-pass/alt-implicit-copy-unique.rs
src/test/run-pass/alt-naked-record-expr.rs
src/test/run-pass/alt-naked-record.rs
src/test/run-pass/alt-ref-binding-mut.rs
src/test/run-pass/argument-passing.rs
src/test/run-pass/auto-instantiate.rs
src/test/run-pass/borrowck-binding-mutbl.rs
src/test/run-pass/borrowck-mut-uniq.rs
src/test/run-pass/borrowck-preserve-box-in-discr.rs
src/test/run-pass/borrowck-preserve-box-in-field.rs
src/test/run-pass/borrowck-preserve-box-in-pat.rs
src/test/run-pass/borrowck-preserve-box-in-uniq.rs
src/test/run-pass/borrowck-preserve-expl-deref.rs
src/test/run-pass/borrowck-root-while-cond-2.rs
src/test/run-pass/borrowck-root-while-cond.rs
src/test/run-pass/box-pattern.rs
src/test/run-pass/box-unbox.rs
src/test/run-pass/const-bound.rs
src/test/run-pass/const-fields-and-indexing.rs
src/test/run-pass/const-rec-and-tup.rs
src/test/run-pass/const-region-ptrs.rs
src/test/run-pass/crateresolve5.rs
src/test/run-pass/early-vtbl-resolution.rs
src/test/run-pass/explicit-self-generic.rs
src/test/run-pass/explicit-self.rs
src/test/run-pass/expr-alt-generic.rs
src/test/run-pass/expr-alt-struct.rs
src/test/run-pass/expr-block-generic.rs
src/test/run-pass/expr-block-slot.rs
src/test/run-pass/expr-block.rs
src/test/run-pass/expr-copy.rs
src/test/run-pass/expr-if-generic.rs
src/test/run-pass/expr-if-struct.rs
src/test/run-pass/exterior.rs
src/test/run-pass/fixed_length_vec_glue.rs
src/test/run-pass/for-destruct.rs
src/test/run-pass/generic-box.rs
src/test/run-pass/generic-derived-type.rs
src/test/run-pass/generic-drop-glue.rs
src/test/run-pass/generic-exterior-box.rs
src/test/run-pass/generic-exterior-unique.rs
src/test/run-pass/generic-fn.rs
src/test/run-pass/generic-tag-values.rs
src/test/run-pass/generic-type.rs
src/test/run-pass/generic-unique.rs
src/test/run-pass/guards.rs
src/test/run-pass/infer-with-expected.rs
src/test/run-pass/init-res-into-things.rs
src/test/run-pass/instantiable.rs
src/test/run-pass/issue-1112.rs
src/test/run-pass/issue-1989.rs
src/test/run-pass/issue-2463.rs
src/test/run-pass/issue-2633.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2989.rs
src/test/run-pass/issue-980.rs
src/test/run-pass/lambda-infer-unresolved.rs
src/test/run-pass/large-records.rs
src/test/run-pass/last-use-in-cap-clause.rs
src/test/run-pass/last-use-is-capture.rs
src/test/run-pass/let-destruct-fresh-mem.rs
src/test/run-pass/let-destruct.rs
src/test/run-pass/log-linearized.rs
src/test/run-pass/morestack4.rs
src/test/run-pass/move-1-unique.rs
src/test/run-pass/move-1.rs
src/test/run-pass/move-2-unique.rs
src/test/run-pass/move-2.rs
src/test/run-pass/move-3-unique.rs
src/test/run-pass/move-3.rs
src/test/run-pass/move-4-unique.rs
src/test/run-pass/move-4.rs
src/test/run-pass/mutable-vec-drop.rs
src/test/run-pass/nested-exhaustive-alt.rs
src/test/run-pass/nested-patterns.rs
src/test/run-pass/newtype.rs
src/test/run-pass/output-slot-variants.rs
src/test/run-pass/pass-by-copy.rs
src/test/run-pass/pure-fmt.rs
src/test/run-pass/pure-sum.rs
src/test/run-pass/readalias.rs
src/test/run-pass/rec-align-u32.rs
src/test/run-pass/rec-align-u64.rs
src/test/run-pass/rec-auto.rs
src/test/run-pass/rec-extend.rs
src/test/run-pass/rec-tup.rs
src/test/run-pass/rec.rs
src/test/run-pass/record-pat.rs
src/test/run-pass/reflect-visit-data.rs
src/test/run-pass/regions-infer-borrow-scope.rs
src/test/run-pass/regions-mock-trans-impls.rs
src/test/run-pass/regions-mock-trans.rs
src/test/run-pass/regions-self-impls.rs
src/test/run-pass/regions-trait.rs
src/test/run-pass/resource-cycle.rs
src/test/run-pass/resource-cycle2.rs
src/test/run-pass/resource-cycle3.rs
src/test/run-pass/resource-generic.rs
src/test/run-pass/rt-circular-buffer.rs
src/test/run-pass/sendfn-generic-fn.rs
src/test/run-pass/shape_intrinsic_tag_then_rec.rs
src/test/run-pass/struct-return.rs
src/test/run-pass/task-comm-16.rs
src/test/run-pass/trait-cast.rs
src/test/run-pass/type-namespace.rs
src/test/run-pass/uniq-cc-generic.rs
src/test/run-pass/uniq-cc.rs
src/test/run-pass/unique-autoderef-field.rs
src/test/run-pass/unique-destructure.rs
src/test/run-pass/unique-pat-2.rs
src/test/run-pass/unique-rec.rs
src/test/run-pass/vec-drop.rs
src/test/run-pass/writealias.rs

index 291a506c4ebb05e41df3394c89a1a8787b93dc85..d20653e429ae93b838b990d94f12b702d9d05f78 100644 (file)
 
 use dvec::DVec;
 
-type entry<A,B> = {key: A, value: B};
-struct alist<A,B> { eq_fn: fn@(A,A) -> bool, data: DVec<entry<A,B>> }
+struct Entry<A,B> {key: A, value: B}
+
+struct alist<A,B> { eq_fn: fn@(A,A) -> bool, data: DVec<Entry<A,B>> }
 
 fn alist_add<A: Copy, B: Copy>(lst: alist<A,B>, k: A, v: B) {
-    lst.data.push({key:k, value:v});
+    lst.data.push(Entry{key:k, value:v});
 }
 
 fn alist_get<A: Copy, B: Copy>(lst: alist<A,B>, k: A) -> B {
index de893c28cdda3660d2e9fe63d43a026a5ff1f4b9..e07f24c2fb7783310a186520ae547345785175a4 100644 (file)
 #[crate_type = "lib"];
 #[legacy_exports];
 
-fn structural() -> { name: ~str, val: int } {
-    { name: ~"crateresolve5", val: 10 }
+struct NameVal { name: ~str, val: int }
+
+fn struct_nameval() -> NameVal {
+    NameVal { name: ~"crateresolve5", val: 10 }
 }
 
 enum e {
index 67af05a28908667091f4bdba1e3219e434221202..be7e993d29c0ebe94868734831728f9cf7ec717e 100644 (file)
@@ -14,8 +14,9 @@
 #[crate_type = "lib"];
 #[legacy_exports];
 
-fn structural() -> { name: ~str, val: int } {
-    { name: ~"crateresolve5", val: 10 }
+struct NameVal { name: ~str, val: int }
+fn struct_nameval() -> NameVal {
+    NameVal { name: ~"crateresolve5", val: 10 }
 }
 
 enum e {
index beb1a5fc6c237604c017e9c85788c667e2a74f3f..888acf30b2a933bfdece4ff22d047890fd947d92 100644 (file)
 
 enum sty { ty_nil, }
 
-type raw_t = {struct_: sty, cname: Option<~str>, hash: uint};
+struct RawT {struct_: sty, cname: Option<~str>, hash: uint}
 
-fn mk_raw_ty(st: sty, cname: Option<~str>) -> raw_t {
-    return {struct_: st, cname: cname, hash: 0u};
+fn mk_raw_ty(st: sty, cname: Option<~str>) -> RawT {
+    return RawT {struct_: st, cname: cname, hash: 0u};
 }
 
 fn main() { mk_raw_ty(ty_nil, None::<~str>); }
index ded15ca94f119ce60b4142f3ceea785e950856cd..2e0e3ea8f559fd48ecf2379578f63ccfe382af9a 100644 (file)
@@ -8,18 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type pair<A,B> = {
+struct Pair<A,B> {
     a: A, b: B
-};
+}
 
-enum rec<A> = _rec<A>;
-type _rec<A> = {
+enum RecEnum<A> = Rec<A>;
+struct Rec<A> {
     val: A,
-    mut rec: Option<@rec<A>>
-};
+    mut rec: Option<@RecEnum<A>>
+}
 
 fn make_cycle<A:Copy>(a: A) {
-    let g: @rec<A> = @rec({val: a, mut rec: None});
+    let g: @RecEnum<A> = @RecEnum(Rec {val: a, mut rec: None});
     g.rec = Some(g);
 }
 
index 869604442ea49313eeb4c009a342dac1136469a6..2901754c8f2be925ec05980a36b9952f074db8d1 100644 (file)
@@ -10,8 +10,8 @@
 
 enum option<T> { some(T), none, }
 
-type r<T> = {mut v: ~[option<T>]};
+struct R<T> {mut v: ~[option<T>]}
 
 fn f<T>() -> ~[T] { return ~[]; }
 
-fn main() { let r: r<int> = {mut v: ~[]}; r.v = f(); }
+fn main() { let r: R<int> = R {mut v: ~[]}; r.v = f(); }
index f703eed6a21c5c7502dba6e26378bc581c0f50b4..a30a0c64215ec0741143e0d2ed14906f3b357db4 100644 (file)
@@ -8,10 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Pair { mut a: ~int, mut b: ~int }
+
 fn main() {
-    let x = ~{mut a: ~10, b: ~20};
+    let x = ~Pair {mut a: ~10, b: ~20};
     match x {
-      ~{a: ref mut a, b: ref b} => {
+      ~Pair {a: ref mut a, b: ref b} => {
         assert **a == 10; *a = ~30; assert **a == 30;
       }
     }
index 063e01fc02f4bbd24e1cb3aa4824668193bc6c7d..f23cf72cf1f8eeeb9efa280435fb2eb0225691dc 100644 (file)
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct X { x: int }
+
 fn main() {
     let x = match 0 {
-      _ => {
+      _ => {
         x: 0
       }.x
     };
index 0d3d8768e9686d77913c0bd6a169862528595f08..dbb8b07b8e84e66ee094b0806006852fed24b8b7 100644 (file)
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct X { x: int }
+
 fn main() {
     let x = match 0 {
-      _ => {
+      _ => {
         x: 0
       }
     };
index 2ec0c1d81ce652d88968b1c1d7d5c6d5319a449e..fc124041fd4e68102e5acd2ba6925acafac26d85 100644 (file)
@@ -8,18 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type rec = {
+struct Rec {
     f: int
-};
+}
 
-fn destructure(x: &mut rec) {
+fn destructure(x: &mut Rec) {
     match *x {
-      {f: ref mut f} => *f += 1
+      Rec {f: ref mut f} => *f += 1
     }
 }
 
 fn main() {
-    let mut v = {f: 22};
+    let mut v = Rec {f: 22};
     destructure(&mut v);
     assert v.f == 23;
 }
index d38683f7eabaaf055d285ad997500cc44c6756b7..560a6cbb823d11ef0751476c5189ab60a72b44f7 100644 (file)
@@ -11,7 +11,9 @@
 // xfail-fast
 #[legacy_modes];
 
-fn f1(a: {mut x: int}, b: &mut int, -c: int) -> int {
+struct X { mut x: int }
+
+fn f1(a: X, b: &mut int, -c: int) -> int {
     let r = a.x + *b + c;
     a.x = 0;
     *b = 10;
@@ -21,7 +23,7 @@ fn f1(a: {mut x: int}, b: &mut int, -c: int) -> int {
 fn f2(a: int, f: fn(int)) -> int { f(1); return a; }
 
 fn main() {
-    let mut a = {mut x: 1}, b = 2, c = 3;
+    let mut a = {mut x: 1}, b = 2, c = 3;
     assert (f1(a, &mut b, move c) == 6);
     assert (a.x == 0);
     assert (b == 10);
index f96cfeb3f37e8765d8ccec5338428f2292f158b1..a2031019a4d1f88fce7d0ff9820902fcdaaf8071 100644 (file)
 
 
 // -*- rust -*-
-fn f<T: Copy, U: Copy>(x: T, y: U) -> {a: T, b: U} { return {a: x, b: y}; }
+
+struct Pair<T, U> { a: T, b: U }
+struct Triple { x: int, y: int, z: int }
+
+fn f<T: Copy, U: Copy>(x: T, y: U) -> Pair<T, U> { return Pair {a: x, b: y}; }
 
 fn main() {
-    log(debug, f({x: 3, y: 4, z: 5}, 4).a.x);
+    log(debug, f(Triple {x: 3, y: 4, z: 5}, 4).a.x);
     log(debug, f(5, 6).a);
 }
index 04e00b5972c59cf2f5ca52dccead713f3b4fd2cf..7a620d584819bd52f353c26f97e15846bb91dfdf 100644 (file)
@@ -8,14 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct F { mut f: ~[int] }
+
 fn impure(_v: &[int]) {
 }
 
 fn main() {
-    let x = {mut f: ~[3]};
+    let x = F {f: ~[3]};
 
     match x {
-      {f: ref mut v} => {
+      {f: ref mut v} => {
         impure(*v);
       }
     }
index ece12f8d4c0adfd1073e94561aadc4d5b03244e2..b6c205524a809ef90feb12d846670a14a071713f 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type ints = {sum: ~int, values: ~[int]};
+struct Ints {sum: ~int, values: ~[int]}
 
-fn add_int(x: &mut ints, v: int) {
+fn add_int(x: &mut Ints, v: int) {
     *x.sum += v;
     let mut values = ~[];
     x.values <-> values;
@@ -18,13 +18,13 @@ fn add_int(x: &mut ints, v: int) {
     x.values <-> values;
 }
 
-fn iter_ints(x: &ints, f: fn(x: &int) -> bool) {
+fn iter_ints(x: &Ints, f: fn(x: &int) -> bool) {
     let l = x.values.len();
     uint::range(0, l, |i| f(&x.values[i]))
 }
 
 fn main() {
-    let mut ints = ~{sum: ~0, values: ~[]};
+    let mut ints = ~Ints {sum: ~0, values: ~[]};
     add_int(ints, 22);
     add_int(ints, 44);
 
index 5cee34b9228a618f05da3539bec157abdbe16c99..14757bfa3d8af93ee25ad2cf8659a5217a64f3a0 100644 (file)
 
 // exec-env:RUST_POISON_ON_FREE=1
 
+struct F { f: ~int }
+
 fn main() {
-    let mut x = @{f: ~3};
+    let mut x = @{f: ~3};
     match x {
-      @{f: ref b_x} => {
+      @{f: ref b_x} => {
         assert **b_x == 3;
         assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(**b_x));
 
-        x = @{f: ~4};
+        x = @{f: ~4};
 
         debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(**b_x)) as uint);
         assert **b_x == 3;
index 333845c9cade4638ab9902b7961d2eaac1024ff5..87592f548179fe5c65f4bf956a6ceccc700f8fcf 100644 (file)
@@ -17,12 +17,14 @@ fn borrow(x: &int, f: fn(x: &int)) {
     assert before == after;
 }
 
+struct F { f: ~int }
+
 fn main() {
-    let mut x = @{f: ~3};
+    let mut x = @{f: ~3};
     do borrow(x.f) |b_x| {
         assert *b_x == 3;
         assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x));
-        x = @{f: ~4};
+        x = @{f: ~4};
 
         debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint);
         assert *b_x == 3;
index f641131e48ea9338199b927ab6e6a4021a8c345b..ccf9be1d585dbb3189202378e31a69d4d2d58c28 100644 (file)
 
 // exec-env:RUST_POISON_ON_FREE=1
 
+struct F { f: ~int }
+
 fn main() {
-    let mut x = @mut @{f: ~3};
+    let mut x = @mut @{f: ~3};
     match x {
-      @@{f: ref b_x} => {
+      @@F{f: ref b_x} => {
         assert **b_x == 3;
         assert ptr::addr_of(&(x.f)) == ptr::addr_of(b_x);
 
-        *x = @{f: ~4};
+        *x = @{f: ~4};
 
         debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(**b_x)) as uint);
         assert **b_x == 3;
index 90fe4000ddb4ae4287f9a52298b8b3de66e314b8..1f6bfe20bb12821f2872489204fba9c4883e990b 100644 (file)
@@ -17,12 +17,14 @@ fn borrow(x: &int, f: fn(x: &int)) {
     assert before == after;
 }
 
+struct F { f: ~int }
+
 fn main() {
-    let mut x = ~mut @{f: ~3};
+    let mut x = ~mut @F{f: ~3};
     do borrow(x.f) |b_x| {
         assert *b_x == 3;
         assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x));
-        *x = @{f: ~4};
+        *x = @F{f: ~4};
 
         debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint);
         assert *b_x == 3;
index 93ec211930782167d5614fc05d5d0c13377dc45a..30250c26a9a6c6bcf9bd9ba9f45e6664f13554f1 100644 (file)
@@ -17,12 +17,14 @@ fn borrow(x: &int, f: fn(x: &int)) {
     assert before == after;
 }
 
+struct F { f: ~int }
+
 fn main() {
-    let mut x = @{f: ~3};
+    let mut x = @{f: ~3};
     do borrow((*x).f) |b_x| {
         assert *b_x == 3;
         assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x));
-        x = @{f: ~4};
+        x = @{f: ~4};
 
         debug!("ptr::addr_of(*b_x) = %x", ptr::addr_of(&(*b_x)) as uint);
         assert *b_x == 3;
index 0ce704d4670ab1b1a1ed64c9de2de6e66075723a..0e4f15d49db2ee4ef0551af3fbe4cbaf8061c757 100644 (file)
@@ -8,7 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct F { mut f: @G }
+struct G { g: ~[int] }
+
 fn main() {
-    let rec = @{mut f: @{g: ~[1, 2, 3]}};
+    let rec = @F {mut f: @G {g: ~[1, 2, 3]}};
     while rec.f.g.len() == 23 {}
 }
index 893cc6c9732c6418af4fae052b247b754773ca88..e8e3cf297ba7b310e0d24fef7000f47e4991ef7e 100644 (file)
@@ -10,7 +10,9 @@
 
 fn borrow<T>(x: &r/T) -> &r/T {x}
 
+struct Rec { mut f: @int }
+
 fn main() {
-    let rec = @{mut f: @22};
+    let rec = @Rec {mut f: @22};
     while *borrow(rec.f) == 23 {}
 }
index 3688fe94815db756756e138127ddcdea9fdf0da3..91e416b72e18fb26a58d9d526fba8767c9e764cc 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type foo = {a: int, b: uint};
-enum bar { u(@foo), w(int), }
+struct Foo {a: int, b: uint}
+enum bar { u(@Foo), w(int), }
 
 fn main() {
-    assert (match u(@{a: 10, b: 40u}) {
-              u(@{a: a, b: b}) => { a + (b as int) }
+    assert (match u(@Foo{a: 10, b: 40u}) {
+              u(@Foo{a: a, b: b}) => { a + (b as int) }
               _ => { 66 }
             } == 50);
 }
index 57bec6c0c27dcd29afebf0cf19efe0b7c67a6947..355850147131843f2ecc1ca2cd3361ac6d160177 100644 (file)
 
 
 
-type box<T: Copy> = {c: @T};
+struct Box<T: Copy> {c: @T}
 
-fn unbox<T: Copy>(b: box<T>) -> T { return *b.c; }
+fn unbox<T: Copy>(b: Box<T>) -> T { return *b.c; }
 
 fn main() {
     let foo: int = 17;
-    let bfoo: box<int> = {c: @foo};
+    let bfoo: Box<int> = Box {c: @foo};
     debug!("see what's in our box");
     assert (unbox::<int>(bfoo) == foo);
 }
index 4defb3c6f3750b61ab986341fd9d91d6363c1e88..3c55409dde889ee70fff7ef848345f51c8391467 100644 (file)
 
 fn foo<T: Copy Const>(x: T) -> T { x }
 
+struct F { field: int }
+
 fn main() {
     foo(1);
     foo(~"hi");
     foo(~[1, 2, 3]);
-    foo({field: 42});
+    foo(F{field: 42});
     foo((1, 2u));
     foo(@1);
     foo(~1);
index dd5e94b52eb26de4f7a9deb7a41e3c4433743585..6dccecb5aa8dcf4002904a70655713c70952c0db 100644 (file)
 const y : &[int] = &[1,2,3,4];
 const q : int = y[2];
 
-const s : {a: int, b: int} = {a: 10, b: 20};
+struct S {a: int, b: int}
+
+const s : S = S {a: 10, b: 20};
 const t : int = s.b;
 
-const k : {a: int, b: int, c: {d: int, e: int}} = {a: 10, b: 20, c: {d: 30,
-                                                                     e: 40}};
+struct K {a: int, b: int, c: D}
+struct D { d: int, e: int }
+
+const k : K = K {a: 10, b: 20, c: D {d: 30,
+                                     e: 40}};
 const m : int = k.c.e;
 
 fn main() {
index 4764bb252484f1cc1560e322621a89bd7b2596e2..b3d971a2cefda45adf17a57375e9a7bc474a78fb 100644 (file)
@@ -8,13 +8,15 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Pair { a: float, b: float }
+
+struct AnotherPair { x: (i64, i64), y: Pair }
+
 const x : (i32,i32) = (0xfeedf00dd,0xca11ab1e);
-const y : { x: (i64, i64),
-            y: { a: float,
-                 b: float } } = { x: (0xf0f0f0f0_f0f0f0f0,
-                                      0xabababab_abababab),
-                                  y: { a: 3.14159265358979323846,
-                                       b: 2.7182818284590452354 } };
+const y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0,
+                                         0xabababab_abababab),
+                           y: Pair { a: 3.14159265358979323846,
+                                     b: 2.7182818284590452354 }};
 
 fn main() {
     let (p, _) = y.x;
index ce5e9ade8cac59ceb797f59303775698ffa1bd91..c8b08b1e35a7a0784e731e45719e496fc975605a 100644 (file)
@@ -9,9 +9,11 @@
 // except according to those terms.
 
 
+struct Pair { a: int, b: &int }
+
 const x: &int = &10;
 
-const y: &{a: int, b: &int} = &{a: 15, b: x};
+const y: &Pair = &Pair {a: 15, b: x};
 
 fn main() {
     io::println(fmt!("x = %?", *x));
index 4b4c91ae6f0b63302443e569371d5dc37248b09a..0b0d9a839ce6865ec984c28d38ef21b05da20a0e 100644 (file)
@@ -17,8 +17,8 @@
 
 fn main() {
     // Structural types can be used between two versions of the same crate
-    assert cr5_1::structural().name == cr5_2::structural().name;
-    assert cr5_1::structural().val == cr5_2::structural().val;
+    assert cr5_1::struct_nameval().name == cr5_2::struct_nameval().name;
+    assert cr5_1::struct_nameval().val == cr5_2::struct_nameval().val;
     // Make sure these are actually two different crates
     assert cr5_1::f() == 10 && cr5_2::f() == 20;
 }
index 23a9bfeccc30c546bd359dad877e46c4961dd2de..2e647d25c747815a01add80b2f5786d55c347706 100644 (file)
@@ -17,9 +17,11 @@ fn foo() -> Option<A> { None }
 }
 fn foo_func<A, B: thing<A>>(x: B) -> Option<A> { x.foo() }
 
+struct A { a: int }
+
 fn main() {
 
-    for iter::eachi(&(Some({a: 0}))) |i, a| { 
+    for iter::eachi(&(Some({a: 0}))) |i, a| { 
         debug!("%u %d", i, a.a);
     }
 
index 674746530fa25db3971eca832a45c4c7a1a6e3b2..bb57710969f5203bddd8b4d958514794681e9aaf 100644 (file)
 type HashFn<K> = pure fn~(K) -> uint;
 type EqFn<K> = pure fn~(K, K) -> bool;
 
+struct LM { resize_at: uint, size: uint }
+
 enum LinearMap<K,V> {
-    LinearMap_({
-        resize_at: uint,
-        size: uint})
+    LinearMap_(LM)
 }
 
 fn linear_map<K,V>() -> LinearMap<K,V> {
-    LinearMap_({
+    LinearMap_(LM{
         resize_at: 32,
         size: 0})
 }
index 06b9f0d8ca5cd9d139009c72e3c5119dddf6696b..b4a80906b33a6a96a65fe77bb53801bb84411ded 100644 (file)
 
 const tau: float = 2.0*3.14159265358979323;
 
-type point = {x: float, y: float};
-type size = {w: float, h: float};
+struct Point {x: float, y: float}
+struct Size {w: float, h: float}
 enum shape {
-    circle(point, float),
-    rectangle(point, size)
+    circle(Point, float),
+    rectangle(Point, Size)
 }
 
 
@@ -37,16 +37,18 @@ fn select<T>(&self, threshold: float,
 fn select_based_on_unit_circle<T>(
     threshold: float, a: &r/T, b: &r/T) -> &r/T {
 
-    let shape = &circle({x: 0.0, y: 0.0}, 1.0);
+    let shape = &circle(Point{x: 0.0, y: 0.0}, 1.0);
     shape.select(threshold, a, b)
 }
 
 
 struct thing {
-    x: {mut a: @int}
+    x: A
 }
 
-fn thing(x: {mut a: @int}) -> thing {
+struct A { mut a: @int }
+
+fn thing(x: A) -> thing {
     thing {
         x: copy x
     }
@@ -56,7 +58,7 @@ impl thing {
     fn foo(@self) -> int { *self.x.a }
     fn bar(~self) -> int { *self.x.a }
     fn quux(&self) -> int { *self.x.a }
-    fn baz(&self) -> &self/{mut a: @int} { &self.x }
+    fn baz(&self) -> &self/A { &self.x }
     fn spam(self) -> int { *self.x.a }
 }
 
@@ -65,14 +67,14 @@ impl thing: Nus { fn f(&self) {} }
 
 fn main() {
 
-    let x = @thing({mut a: @10});
+    let x = @thing({mut a: @10});
     assert x.foo() == 10;
     assert x.quux() == 10;
 
-    let y = ~thing({mut a: @10});
+    let y = ~thing({mut a: @10});
     assert (copy y).bar() == 10;
     assert y.quux() == 10;
 
-    let z = thing({mut a: @11});
+    let z = thing({mut a: @11});
     assert z.spam() == 11;
 }
index 43b480cd8a49234cf4e5568c7703b48f104777b6..61e92500cc8aef89382869982300d8c6f55725e7 100644 (file)
@@ -24,13 +24,13 @@ fn test_bool() {
     test_generic::<bool>(true, compare_bool);
 }
 
-type t = {a: int, b: int};
+struct Pair { a: int, b: int }
 
 fn test_rec() {
-    fn compare_rec(t1: t, t2: t) -> bool {
+    fn compare_rec(t1: Pair, t2: Pair) -> bool {
         t1.a == t2.a && t1.b == t2.b
     }
-    test_generic::<t>({a: 1, b: 2}, compare_rec);
+    test_generic::<Pair>(Pair {a: 1, b: 2}, compare_rec);
 }
 
 fn main() { test_bool(); test_rec(); }
index c14eb1072aa0216ff0671c1967cdda3926c7c362..1cc9d4ba6842845834eec67e8aa333c3c51d527b 100644 (file)
 
 // -*- rust -*-
 
-// Tests for match as expressions resulting in structural types
+// Tests for match as expressions resulting in struct types
+struct R { i: int }
+
 fn test_rec() {
-    let rs = match true { true => {i: 100}, _ => fail };
+    let rs = match true { true => {i: 100}, _ => fail };
     assert (rs.i == 100);
 }
 
index 22c01f7893aae2fa82a1d5851429011a64908b5a..6cfc06307c416faf3f227e45a1fcdfd50acb0cfe 100644 (file)
@@ -26,13 +26,13 @@ fn test_bool() {
     test_generic::<bool>(true, compare_bool);
 }
 
-type t = {a: int, b: int};
+struct Pair {a: int, b: int}
 
 fn test_rec() {
-    fn compare_rec(t1: t, t2: t) -> bool {
+    fn compare_rec(t1: Pair, t2: Pair) -> bool {
         t1.a == t2.a && t1.b == t2.b
     }
-    test_generic::<t>({a: 1, b: 2}, compare_rec);
+    test_generic::<Pair>(Pair {a: 1, b: 2}, compare_rec);
 }
 
 fn main() { test_bool(); test_rec(); }
index d35a49409ba6dca4a21ab2816bf488be69476652..8c173ae5d76b52de0a39c8883b6925c070968f1e 100644 (file)
@@ -9,9 +9,13 @@
 // except according to those terms.
 
 // Regression test for issue #377
+
+struct A { a: int }
+struct V { v: int }
+
 fn main() {
-    let a = { let b = {a: 3}; b };
+    let a = { let b = {a: 3}; b };
     assert (a.a == 3);
-    let c = { let d = {v: 3}; d };
+    let c = { let d = {v: 3}; d };
     assert (c.v == 3);
 }
index 6ae823df61895a06e3e688321bc07191e586d266..490f3950f9f3e630d5ebb02e175070c4e8a356f8 100644 (file)
@@ -16,7 +16,9 @@
 // Tests for standalone blocks as expressions
 fn test_basic() { let rs: bool = { true }; assert (rs); }
 
-fn test_rec() { let rs = { {v1: 10, v2: 20} }; assert (rs.v2 == 20); }
+struct RS { v1: int, v2: int }
+
+fn test_rec() { let rs = { RS {v1: 10, v2: 20} }; assert (rs.v2 == 20); }
 
 fn test_filled_with_stuff() {
     let rs = { let mut a = 0; while a < 10 { a += 1; } a };
index 8dedfb73e9b69dc9772962fe4581ef1339ba2327..69dcac9f03a424e95c51a14d47213da858cc5635 100644 (file)
 // xfail-fast
 #[legacy_modes];
 
-fn f(arg: {mut a: int}) {
+fn f(arg: A) {
     arg.a = 100;
 }
 
+struct A { mut a: int }
+
 fn main() {
-    let x = {mut a: 10};
+    let x = A {a: 10};
     f(x);
     assert x.a == 100;
     x.a = 20;
index 9347566d700e369ddedb0dd17dfaef553f47ed65..92f9117dde8dfb7bb4126bae9928bbf9c6d68fa1 100644 (file)
@@ -25,13 +25,13 @@ fn test_bool() {
     test_generic::<bool>(true, false, compare_bool);
 }
 
-type t = {a: int, b: int};
+struct Pair {a: int, b: int}
 
 fn test_rec() {
-    fn compare_rec(t1: t, t2: t) -> bool {
+    fn compare_rec(t1: Pair, t2: Pair) -> bool {
         t1.a == t2.a && t1.b == t2.b
     }
-    test_generic::<t>({a: 1, b: 2}, {a: 2, b: 3}, compare_rec);
+    test_generic::<Pair>(Pair{a: 1, b: 2}, Pair{a: 2, b: 3}, compare_rec);
 }
 
 fn main() { test_bool(); test_rec(); }
index 6f22ea908ad634673849b6a408c710916f4dfd3e..506d607e7e8f3e0f1be254669c3ec6f8fd9de54c 100644 (file)
 
 // -*- rust -*-
 
-// Tests for if as expressions returning structural types
+// Tests for if as expressions returning nominal types
+
+struct I { i: int }
+
 fn test_rec() {
-    let rs = if true { {i: 100} } else { {i: 101} };
+    let rs = if true { I {i: 100} } else { I {i: 101} };
     assert (rs.i == 100);
 }
 
index c9a2db9c6f14cf4bc2a8c737e9fa68b1f24e4f30..2d77a775f34fd6e0885fddb1ef8da6514f326989 100644 (file)
 
 
 // -*- rust -*-
-type point = {x: int, y: int, mut z: int};
+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 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;
+    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);
index 253b68db44ee3a4b4e6f907a8bb107513c712d81..3d6e781c512cb5cf070835c1f45e8c98d17d888d 100644 (file)
@@ -8,9 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Struc { a: u8, b: [int * 3], c: int }
+
 fn main() {
     let arr = [1,2,3];
-    let struc = {a: 13u8, b: arr, c: 42};
+    let struc = Struc {a: 13u8, b: arr, c: 42};
     let s = sys::log_str(&struc);
     assert(s == ~"{a: 13, b: [1, 2, 3], c: 42}");
 }
index 4ab3f5449e44fb2768689e7fc1f405353d9f6270..47da343764c14fc696a0293cc2f5f30aaa4cc819 100644 (file)
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Pair { x: int, y: int }
+
 fn main() {
-    for vec::each(~[{x: 10, y: 20}, {x: 30, y: 0}]) |elt| {
+    for vec::each(~[Pair {x: 10, y: 20}, Pair {x: 30, y: 0}]) |elt| {
         assert (elt.x + elt.y == 30);
     }
 }
index fa6b81175b0818db0cedc53feb23b087505a5b3a..f68cf1676c7293d3df1de5b06653eca3c6a8ce79 100644 (file)
 
 
 
-fn box<T: Copy>(x: {x: T, y: T, z: T}) -> @{x: T, y: T, z: T} { return @x; }
+fn box<T: Copy>(x: Box<T>) -> @Box<T> { return @x; }
+
+struct Box<T> {x: T, y: T, z: T}
 
 fn main() {
-    let x: @{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3});
+    let x: @Box<int> = box::<int>(Box{x: 1, y: 2, z: 3});
     assert (x.y == 2);
 }
index 7cf3f3981ea6a5ea5d43a915a72d48bde979c00d..03f5a84de6937cae742bb9ffa763c9de00636105 100644 (file)
 
 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};
+struct Pair<T> {a: T, b: T}
 
-    let x: pair = {a: t, b: t};
-    return g::<pair>(x);
+fn f<T: Copy>(t: T) -> Pair<T> {
+
+    let x: Pair<T> = Pair {a: t, b: t};
+    return g::<Pair<T>>(x);
 }
 
 fn main() {
index fe1db75f4b8cb269c55d4f86491067bd0c02a5ff..aad24e99058a51902482eaf84f3857307f9a82c7 100644 (file)
@@ -9,7 +9,8 @@
 // except according to those terms.
 
 
+struct Pair { x: @int, y: @int }
 
 fn f<T: Copy>(t: T) { let t1: T = t; }
 
-fn main() { let x = {x: @10, y: @12}; f(x); }
+fn main() { let x = Pair {x: @10, y: @12}; f(x); }
index b26e1aebe1a43570f5a7c6eea86686e50448c4e5..738bb73b0be4fcc41ecded7a614c1e033ac188db 100644 (file)
 
 
 
-type recbox<T: Copy> = {x: @T};
+struct Recbox<T: Copy> {x: @T}
 
-fn reclift<T: Copy>(t: T) -> recbox<T> { return {x: @t}; }
+fn reclift<T: Copy>(t: T) -> Recbox<T> { return Recbox {x: @t}; }
 
 fn main() {
     let foo: int = 17;
-    let rbfoo: recbox<int> = reclift::<int>(foo);
+    let rbfoo: Recbox<int> = reclift::<int>(foo);
     assert (*rbfoo.x == foo);
 }
index 975ce3bc616fecbe62848317c8d00c11a8807439..2095578aefad808b5f186bebc0fbe5830455d6ee 100644 (file)
@@ -8,12 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type recbox<T: Copy> = {x: ~T};
+struct Recbox<T: Copy> {x: ~T}
 
-fn reclift<T: Copy>(t: T) -> recbox<T> { return {x: ~t}; }
+fn reclift<T: Copy>(t: T) -> Recbox<T> { return Recbox {x: ~t}; }
 
 fn main() {
     let foo: int = 17;
-    let rbfoo: recbox<int> = reclift::<int>(foo);
+    let rbfoo: Recbox<int> = reclift::<int>(foo);
     assert (*rbfoo.x == foo);
 }
index fadc501d8693fe359de6cf3ff6349b9edfcc12e9..13ed32e0c2d6513e5d8a6fdf03209e76df549084 100644 (file)
 // -*- rust -*-
 fn id<T: Copy>(x: T) -> T { return x; }
 
-type triple = {x: int, y: int, z: int};
+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 = {x: 65, y: 66, z: 67};
-    let mut q: triple = {x: 68, y: 69, z: 70};
+    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);
+    q = id::<Triple>(p);
     x = p.z;
     y = q.z;
     log(debug, y);
index 0f41be3e6fcf70f23e8279e839b9c0b01ae120ed..9fd5f4fadff96514f1b7a5cb85e445639eb7b475 100644 (file)
 // -*- rust -*-
 enum noption<T> { some(T), }
 
+struct Pair { x: int, y: int }
+
 fn main() {
     let nop: noption<int> = some::<int>(5);
     match nop { some::<int>(n) => { log(debug, n); assert (n == 5); } }
-    let nop2: noption<{x: int, y: int}> = some({x: 17, y: 42});
+    let nop2: noption<Pair> = some(Pair{x: 17, y: 42});
     match nop2 {
       some(t) => {
         log(debug, t.x);
index bf006b4ff58c49f687af8be17245a910f491b09c..e0f6363eb6b34bbea00f6b00258784bf6ac0994a 100644 (file)
 
 
 
-type pair<T> = {x: T, y: T};
+struct Pair<T> {x: T, y: T}
 
 fn main() {
-    let x: pair<int> = {x: 10, y: 12};
+    let x: Pair<int> = Pair {x: 10, y: 12};
     assert (x.x == 10);
     assert (x.y == 12);
 }
index d6296fff2f43721f30c78181addb52916a1bcf3f..01e899db23a663d0dec9b9bc8c5be0d79d4dfc45 100644 (file)
@@ -8,10 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Triple<T> { x: T, y: T, z: T }
 
-fn box<T: Copy>(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { return ~x; }
+fn box<T: Copy>(x: Triple<T>) -> ~Triple<T> { return ~x; }
 
 fn main() {
-    let x: ~{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3});
+    let x: ~Triple<int> = box::<int>(Triple{x: 1, y: 2, z: 3});
     assert (x.y == 2);
 }
index 628cbe9b7cc4d885f5ae63d5cb7c46cf01f889fd..2ba0660cc70547888647b1b94acde29e19671e94 100644 (file)
@@ -8,16 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Pair { x: int, y: int }
+
 fn main() {
     let a =
         match 10 { x if x < 7 => { 1 } x if x < 11 => { 2 } 10 => { 3 } _ => { 4 } };
     assert (a == 2);
 
     let b =
-        match {x: 10, y: 20} {
+        match Pair {x: 10, y: 20} {
           x if x.x < 5 && x.y < 5 => { 1 }
-          {x: x, y: y} if x == 10 && y == 20 => { 2 }
-          {x: x, y: y} => { 3 }
+          Pair {x: x, y: y} if x == 10 && y == 20 => { 2 }
+          Pair {x: x, y: y} => { 3 }
         };
     assert (b == 2);
 }
index de1ecd38316be39c3fb1697bbefaa19f155c5a4f..c87987aac3a85fcec757d8ccb581141b1678c7ca 100644 (file)
 // type must be known in this context' if the passing down doesn't
 // happen.)
 
-fn eat_tup(_r: ~@(int, fn@({x: int, y: int}) -> int)) {}
-fn eat_rec(_r: @~{a: int, b: fn@({x: int, y: int}) -> int}) {}
+fn eat_tup(_r: ~@(int, fn@(Pair) -> int)) {}
+fn eat_rec(_r: @~Rec) {}
+
+struct Rec { a: int, b: fn(Pair) -> int }
+struct Pair { x: int, y: int }
 
 fn main() {
     eat_tup(~@(10, |a| a.x ));
-    eat_rec(@~{a: 10, b: |a| a.x });
+    eat_rec(@~Rec{a: 10, b: |a| a.x });
 }
index 1e5342fca3b712946a4808bd3b3cdfad2f40d400..11efd61072c8241fba175a3bec48a62638c69119 100644 (file)
@@ -15,6 +15,8 @@ struct r {
   i: @mut int,
 }
 
+struct Box { x: r }
+
 impl r : Drop {
     fn finalize(&self) {
         *(self.i) = *(self.i) + 1;
@@ -38,7 +40,7 @@ fn test_box() {
 fn test_rec() {
     let i = @mut 0;
     {
-        let a = move {x: r(i)};
+        let a = move Box {x: r(i)};
     }
     assert *i == 1;
 }
@@ -74,7 +76,7 @@ fn test_unique() {
 fn test_box_rec() {
     let i = @mut 0;
     {
-        let a = move @{
+        let a = move @Box {
             x: r(i)
         };
     }
index c98d321a9fc9df35098374b0b6ff61a9e6ae70a5..57065ec44a5184c0c49b8e7d12f26d3ede171b0f 100644 (file)
 
 // check that we do not report a type like this as uninstantiable,
 // even though it would be if the nxt field had type @foo:
-enum foo = {x: uint, nxt: *foo};
+enum foo = X;
+
+struct X { x: uint, nxt: *foo }
 
 fn main() {
-    let x = foo({x: 0u, nxt: ptr::null()});
+    let x = foo(X {x: 0, nxt: ptr::null()});
 }
 
index 8eca57eacbf72ee01afea4d5a2720278f406391d..a29d6d1e3e4b3bcdb9179bfbd2d94cb9d9aec5ee 100644 (file)
@@ -11,7 +11,7 @@
 // Issue #1112
 // Alignment of interior pointers to dynamic-size types
 
-type x<T> = {
+struct X<T> {
     a: T,
     b: u8,
     c: bool,
     e: u16,
     f: u8,
     g: u8
-};
+}
 
 fn main() {
-    let x: x<int> = {
+    let x: X<int> = X {
         a: 12345678,
         b: 9u8,
         c: true,
@@ -34,7 +34,7 @@ fn main() {
     bar(x);
 }
 
-fn bar<T>(x: x<T>) {
+fn bar<T>(x: X<T>) {
     assert x.b == 9u8;
     assert x.c == true;
     assert x.d == 10u8;
index 9c2a6f9f30ed47235e92aa3a06f7013add17200a..ab0e0aa1aba9f78d0fb774e80d2505d1c7146d57 100644 (file)
 
 enum maybe_pointy {
     none,
-    p(@pointy)
+    p(@Pointy)
 }
 
-type pointy = {
+struct Pointy {
     mut a : maybe_pointy,
     mut f : fn@()->(),
-};
+}
 
-fn empty_pointy() -> @pointy {
-    return @{
+fn empty_pointy() -> @Pointy {
+    return @Pointy{
         mut a : none,
         mut f : fn@()->(){},
     }
index 9ac1a886168184160232d08f77900fb66df3dc65..b787677db6814e02f8eeeb7bba68443bcc016a8e 100644 (file)
@@ -8,20 +8,22 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Pair { f: int, g: int }
+
 fn main() {
 
-    let x = {
+    let x = Pair {
         f: 0,
         g: 0,
     };
 
-    let y = {
+    let y = Pair {
         f: 1,
         g: 1,
         .. x
     };
 
-    let z = {
+    let z = Pair {
         f: 1,
         .. x
     };
index 103ae4fe8c40f8236a1b4a5e1f4581129dd8c16d..e209a9a03ed45f86f00b5c57be90eca1e674f7f4 100644 (file)
@@ -18,14 +18,14 @@ fn cat() -> cat {
     }
 }
 
-type kitty_info = {kitty: cat};
+struct KittyInfo {kitty: cat}
 
 // Code compiles and runs successfully if we add a + before the first arg
-fn nyan(kitty: cat, _kitty_info: kitty_info) {
+fn nyan(kitty: cat, _kitty_info: KittyInfo) {
     (kitty.meow)();
 }
 
 fn main() {
     let mut kitty = cat();
-    nyan(copy kitty, {kitty: copy kitty});
+    nyan(copy kitty, KittyInfo {kitty: copy kitty});
 }
index cc3b3d623322de3100e6fce044d567531b135285..f8f2fc461c3ffb8b1e9605af63b2eeefe0a54ce8 100644 (file)
 pub mod pipes {
     use core::cast::{forget, transmute};
 
+    pub struct Stuff<T> {
+        mut state: state,
+        mut blocked_task: Option<task::Task>,
+        mut payload: Option<T>
+    }
+
     pub enum state {
         empty,
         full,
@@ -36,7 +42,7 @@ pub impl state : cmp::Eq {
 
     pub fn packet<T: Owned>() -> *packet<T> {
         unsafe {
-            let p: *packet<T> = cast::transmute(~{
+            let p: *packet<T> = cast::transmute(~Stuff{
                 mut state: empty,
                 mut blocked_task: None::<task::Task>,
                 mut payload: None::<T>
index 20efa7af4878c09f9e917954fba3cf249a48c84c..d77a0817b825fa63828f4a82b690e69548a1b39d 100644 (file)
@@ -22,7 +22,7 @@ fn to_bytes() -> ~[u8] {
 
 // the position of this function is significant! - if it comes before methods
 // then it works, if it comes after it then it doesnt!
-fn to_bools(bitv: {storage: ~[u64]}) -> ~[bool] {
+fn to_bools(bitv: Storage) -> ~[bool] {
     vec::from_fn(8, |i| {
         let w = i / 64;
         let b = i % 64;
@@ -31,9 +31,11 @@ fn to_bools(bitv: {storage: ~[u64]}) -> ~[bool] {
     })
 }
 
+struct Storage { storage: ~[u64] }
+
 fn main() {
     let bools = ~[false, false, true, false, false, true, true, false];
-    let bools2 = to_bools({storage: ~[0b01100100]});
+    let bools2 = to_bools(Storage{storage: ~[0b01100100]});
 
     for uint::range(0, 8) |i| {
         io::println(fmt!("%u => %u vs %u", i, bools[i] as uint, bools2[i] as uint));
index 050f5697321133af27d9541871c5a9ea107726ba..f29231b53d0c86e4bc970ad45328a4e6aa153ccb 100644 (file)
 
 enum maybe_pointy {
     no_pointy,
-    yes_pointy(@pointy),
+    yes_pointy(@Pointy),
 }
 
-type pointy = {
+struct Pointy {
     mut x : maybe_pointy
-};
+}
 
 fn main() {
-    let m = @{ mut x : no_pointy };
+    let m = @Pointy { mut x : no_pointy };
     m.x = yes_pointy(m);
 }
index ed0efa0e4bdab14af8e08b0aca07ee26521ec2c2..1e94f6af90f1d3dd69af127d8fe056435014e955 100644 (file)
 
 // This should typecheck even though the type of e is not fully
 // resolved when we finish typechecking the fn@.
+
+
+struct Refs { mut refs: ~[int], n: int }
+
 fn main() {
-    let e = @{mut refs: ~[], n: 0};
+    let e = @Refs{mut refs: ~[], n: 0};
     let f = fn@ () { log(error, e.n); };
     e.refs += ~[1];
 }
index a45fe552d1a7e245f1f4f7ce0b258e138f6ee4c4..21b68a07560d1ebe49ee25c1dfb3e24db4d2f508 100644 (file)
@@ -12,9 +12,8 @@
 
 
 // -*- rust -*-
-fn f() {
-    let foo:
-            {a: int,
+
+struct Large {a: int,
              b: int,
              c: int,
              d: int,
@@ -25,8 +24,10 @@ fn f() {
              i: int,
              j: int,
              k: int,
-             l: int} =
-        {a: 0,
+             l: int}
+fn f() {
+    let foo: Large =
+        Large {a: 0,
          b: 0,
          c: 0,
          d: 0,
index c7bfe2b6b8fdcc1f107a4bfca7f6d1f556b71d3a..ee08b18de161211189eb6a60ee8a4e5707298184 100644 (file)
 
 // Make sure #1399 stays fixed
 
+struct A { a: ~int }
+
 fn foo() -> fn@() -> int {
     let k = ~22;
-    let _u = {a: copy k};
+    let _u = {a: copy k};
     return fn@(move k) -> int { 22 };
 }
 
index e9028e5d3f9e8e5ca2d79dcd673ae8b2645cf12e..885b3a83da639749d6bf322326b53e7cd300e778 100644 (file)
 
 // Make sure #1399 stays fixed
 
+struct A { a: ~int }
+
 fn main() {
     fn invoke(f: fn@()) { f(); }
     let k = ~22;
-    let _u = {a: copy k};
+    let _u = {a: copy k};
     invoke(|| log(error, copy k) )
 }
index 4e0e8376f6aba72111a19b99e28475809424cb3f..ba7fd4fee5e2b3b8be6af634c38500c263d64dd4 100644 (file)
@@ -8,9 +8,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct X { x: int, y: @A }
+struct A { a: int }
+
 fn main() {
-    let u = {x: 10, y: @{a: 20}};
-    let mut {x: x, y: @{a: a}} = u;
+    let u = X {x: 10, y: @A {a: 20}};
+    let mut X {x: x, y: @A {a: a}} = u;
     x = 100;
     a = 100;
     assert (x == 100);
index 6c3a84e616fa6861fbe8fda3943d837b6e2837bc..be9c8bdf2d6538790bdf488dd8b3ab0aa3e2f0b5 100644 (file)
@@ -10,7 +10,9 @@
 
 enum xx = int;
 
+struct X { x: xx, y: int }
+
 fn main() {
-    let @{x: xx(x), y: y} = @{x: xx(10), y: 20};
+    let @X {x: xx(x), y: y} = @X{x: xx(10), y: 20};
     assert (x + y == 30);
 }
index 0378a8648a13d6ad52293d7026d2faec61bf2620..73e16085c4ee9acc0c5aba8ebd0ac9e9d9c95d6b 100644 (file)
@@ -15,11 +15,13 @@ enum option<T> {
     some(T),
 }
 
-type smallintmap<T> = @{mut v: ~[mut option<T>]};
+struct Smallintmap<T> {mut v: ~[mut option<T>]}
 
-fn mk<T>() -> smallintmap<T> {
+struct V<T> { v: ~[mut option<T>] }
+
+fn mk<T>() -> @Smallintmap<T> {
     let v: ~[mut option<T>] = ~[mut];
-    return @{mut v: move v};
+    return @Smallintmap {mut v: move v};
 }
 
 fn f<T,U>() {
index 44309bbcaec0a475ae6d63588f339cfc33c1325c..35b2993ca33c6e321ddbd25e9ec244fbcb3ef664 100644 (file)
@@ -11,7 +11,7 @@
 // This is testing for stack frames greater than 256 bytes,
 // for which function prologues are generated differently
 
-type biggy = {
+struct Biggy {
     a00: u64,
     a01: u64,
     a02: u64,
     a37: u64,
     a38: u64,
     a39: u64,
-};
+}
 
 
-fn getbig(i: biggy) {
+fn getbig(i: Biggy) {
     if i.a00 != 0u64 {
-        getbig({a00: i.a00 - 1u64,.. i});
+        getbig(Biggy{a00: i.a00 - 1u64,.. i});
     }
 }
 
 fn main() {
-    getbig({
+    getbig(Biggy {
         a00: 10000u64,
         a01: 10000u64,
         a02: 10000u64,
index b99b8a67a2ca58d2392da2a78b49ddb253e79756..e477442376eb04aff3f311365ff275e6ff6f589f 100644 (file)
@@ -8,16 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Triple { x: int, y: int, z: int }
 
-fn test(x: bool, foo: ~{x: int, y: int, z: int}) -> int {
+fn test(x: bool, foo: ~Triple) -> int {
     let bar = foo;
-    let mut y: ~{x: int, y: int, z: int};
-    if x { y = move bar; } else { y = ~{x: 4, y: 5, z: 6}; }
+    let mut y: ~Triple;
+    if x { y = move bar; } else { y = ~Triple{x: 4, y: 5, z: 6}; }
     return y.y;
 }
 
 fn main() {
-    let x = ~{x: 1, y: 2, z: 3};
+    let x = ~Triple{x: 1, y: 2, z: 3};
     assert (test(true, x) == 2);
     assert (test(true, x) == 2);
     assert (test(true, x) == 2);
index 191d4e1c7d7efc05259a9f96daf89c10e4de7356..4c7e5682a1304f1d669ab934da7c672831024c53 100644 (file)
@@ -8,15 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn test(x: bool, foo: @{x: int, y: int, z: int}) -> int {
+struct Triple { x: int, y: int, z: int }
+
+fn test(x: bool, foo: @Triple) -> int {
     let bar = foo;
-    let mut y: @{x: int, y: int, z: int};
-    if x { y = move bar; } else { y = @{x: 4, y: 5, z: 6}; }
+    let mut y: @Triple;
+    if x { y = move bar; } else { y = @Triple{x: 4, y: 5, z: 6}; }
     return y.y;
 }
 
 fn main() {
-    let x = @{x: 1, y: 2, z: 3};
+    let x = @Triple {x: 1, y: 2, z: 3};
     assert (test(true, x) == 2);
     assert (test(true, x) == 2);
     assert (test(true, x) == 2);
index 8ed113e09831fe44784616a1e317f2c244578adf..096daf315ebafa7f6fb8c06e7495d752ad2965de 100644 (file)
@@ -9,5 +9,6 @@
 // except according to those terms.
 
 
+struct X { x: int, y: int, z: int }
 
-fn main() { let x = ~{x: 1, y: 2, z: 3}; let y = move x; assert (y.y == 2); }
+fn main() { let x = ~X{x: 1, y: 2, z: 3}; let y = move x; assert (y.y == 2); }
index da7d23ebddcb26e9f2faea9c50c2e3f088186591..23746c924ad73f153472439a916619382e4193f4 100644 (file)
@@ -9,5 +9,6 @@
 // except according to those terms.
 
 
+struct X { x: int, y: int, z: int }
 
-fn main() { let x = @{x: 1, y: 2, z: 3}; let y = move x; assert (y.y == 2); }
+fn main() { let x = @{x: 1, y: 2, z: 3}; let y = move x; assert (y.y == 2); }
index 9fd122060cca01baf661b96f85cf8f1e1f87213c..e16955f31e817a656d17f65267e89cbd29624c5c 100644 (file)
 
 extern mod std;
 
-fn test(x: bool, foo: ~{x: int, y: int, z: int}) -> int {
+struct Triple { x: int, y: int, z: int }
+
+fn test(x: bool, foo: ~Triple) -> int {
     let bar = foo;
-    let mut y: ~{x: int, y: int, z: int};
-    if x { y = move bar; } else { y = ~{x: 4, y: 5, z: 6}; }
+    let mut y: ~Triple;
+    if x { y = move bar; } else { y = ~Triple {x: 4, y: 5, z: 6}; }
     return y.y;
 }
 
 fn main() {
-    let x = ~{x: 1, y: 2, z: 3};
+    let x = ~Triple{x: 1, y: 2, z: 3};
     for uint::range(0u, 10000u) |_i| {
         assert (test(true, x) == 2);
     }
index 9ecb6d28dd5ca9c626ca5dcf2e1e5894d6ee664a..80de11091ee33cfb0a279b82bb25f23bb171b428 100644 (file)
 
 extern mod std;
 
-fn test(x: bool, foo: @{x: int, y: int, z: int}) -> int {
+struct Triple { x: int, y: int, z: int }
+
+fn test(x: bool, foo: @Triple) -> int {
     let bar = foo;
-    let mut y: @{x: int, y: int, z: int};
-    if x { y = move bar; } else { y = @{x: 4, y: 5, z: 6}; }
+    let mut y: @Triple;
+    if x { y = move bar; } else { y = @Triple{x: 4, y: 5, z: 6}; }
     return y.y;
 }
 
 fn main() {
-    let x = @{x: 1, y: 2, z: 3};
+    let x = @Triple{x: 1, y: 2, z: 3};
     for uint::range(0u, 10000u) |i| {
         assert (test(true, x) == 2);
     }
index 9608f3e08f71e17707da54d621acc1af1710163d..0c2ce79e6aa712f514ab8fdc32dd994b196c585c 100644 (file)
@@ -10,7 +10,9 @@
 
 extern mod std;
 
-fn test(foo: ~{a: int, b: int, c: int}) -> ~{a: int, b: int, c: int} {
+struct Triple {a: int, b: int, c: int}
+
+fn test(foo: ~Triple) -> ~Triple {
     let foo = foo;
     let bar = move foo;
     let baz = move bar;
@@ -18,4 +20,4 @@ fn test(foo: ~{a: int, b: int, c: int}) -> ~{a: int, b: int, c: int} {
     return quux;
 }
 
-fn main() { let x = ~{a: 1, b: 2, c: 3}; let y = test(x); assert (y.c == 3); }
+fn main() { let x = ~Triple{a: 1, b: 2, c: 3}; let y = test(x); assert (y.c == 3); }
index 5545bc96a3d4f9f92c6cbd9bfbcbfc2ef7b710f9..351b78807b83f9fc25b32f5d198eb0537b6d4b5a 100644 (file)
@@ -11,7 +11,9 @@
 
 extern mod std;
 
-fn test(foo: @{a: int, b: int, c: int}) -> @{a: int, b: int, c: int} {
+struct Triple { a: int, b: int, c: int }
+
+fn test(foo: @Triple) -> @Triple {
     let foo = foo;
     let bar = move foo;
     let baz = move bar;
@@ -19,4 +21,8 @@ fn test(foo: @{a: int, b: int, c: int}) -> @{a: int, b: int, c: int} {
     return quux;
 }
 
-fn main() { let x = @{a: 1, b: 2, c: 3}; let y = test(x); assert (y.c == 3); }
+fn main() {
+    let x = @Triple{a: 1, b: 2, c: 3};
+    let y = test(x);
+    assert (y.c == 3);
+}
index 54bd9c69b794a5b9ceeab181e3a6df184b82159c..f774e42134897b5cb19a9df9cf1e5e090ce11b12 100644 (file)
@@ -9,8 +9,10 @@
 // except according to those terms.
 
 
+struct Pair { a: int, b: int}
+
 fn main() {
     // This just tests whether the vec leaks its members.
-    let pvec: ~[mut @{a: int, b: int}] =
-        ~[mut @{a: 1, b: 2}, @{a: 3, b: 4}, @{a: 5, b: 6}];
+    let pvec: ~[mut @Pair] =
+        ~[mut @Pair{a: 1, b: 2}, @Pair{a: 3, b: 4}, @Pair{a: 5, b: 6}];
 }
index b110bb6a604cef1acb93253cfbb296377a880754..c6eb91c564db7299201238d8674281779ca724b6 100644 (file)
@@ -8,11 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Foo { foo: bool, bar: Option<int>, baz: int }
+
 fn main() {
-    match @{foo: true, bar: Some(10), baz: 20} {
-      @{foo: true, bar: Some(_), _} => {}
-      @{foo: false, bar: None, _} => {}
-      @{foo: true, bar: None, _} => {}
-      @{foo: false, bar: Some(_), _} => {}
+    match @Foo{foo: true, bar: Some(10), baz: 20} {
+      @Foo{foo: true, bar: Some(_), _} => {}
+      @Foo{foo: false, bar: None, _} => {}
+      @Foo{foo: true, bar: None, _} => {}
+      @Foo{foo: false, bar: Some(_), _} => {}
     }
 }
index 17e0fdd56106570c2f5cd4c2cf56145c24d4a51c..06d630255c0b1798a3d5fa3cc93a25ca1467d596 100644 (file)
@@ -8,15 +8,20 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct A { a: int, b: @int }
+struct B { a: int, b: C }
+struct D { a: int, d: C }
+struct C { mut c: int }
+
 fn main() {
-    match {a: 10, b: @20} {
-        x@{a, b: @20} => { assert x.a == 10; assert a == 10; }
-        {b, _} => { fail; }
+    match {a: 10, b: @20} {
+        x@{a, b: @20} => { assert x.a == 10; assert a == 10; }
+        {b, _} => { fail; }
     }
-    let x@{b, _} = {a: 10, b: {mut c: 20}};
+    let x@B {b, _} = B {a: 10, b: C {mut c: 20}};
     x.b.c = 30;
     assert b.c == 20;
-    let y@{d, _} = {a: 10, d: {mut c: 20}};
+    let y@D {d, _} = D {a: 10, d: C {mut c: 20}};
     y.d.c = 30;
     assert d.c == 20;
 }
index aaf7d1d3bbb230f4b9343be2175b500013419b3a..cb781ae6a993e3468af8c1df9b3b4d7c341fc5b9 100644 (file)
@@ -8,11 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-enum mytype = {compute: extern fn(mytype) -> int, val: int};
+enum mytype = Mytype;
+
+struct Mytype {compute: extern fn(mytype) -> int, val: int}
 
 fn compute(i: mytype) -> int { return i.val + 20; }
 
 fn main() {
-    let myval = mytype({compute: compute, val: 30});
+    let myval = mytype(Mytype{compute: compute, val: 30});
     assert ((myval.compute)(myval) == 50);
 }
index 0a0f8ec7114263fb9b6e6692223db5c392659cb3..3667a9802516fea0b5d734021aca8cea89af30ea 100644 (file)
@@ -8,27 +8,28 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
+struct A { a: int, b: int }
+struct Abox { a: @int, b: @int }
 
 fn ret_int_i() -> int { return 10; }
 
 fn ret_ext_i() -> @int { return @10; }
 
-fn ret_int_rec() -> {a: int, b: int} { return {a: 10, b: 10}; }
+fn ret_int_rec() -> A { return A {a: 10, b: 10}; }
 
-fn ret_ext_rec() -> @{a: int, b: int} { return @{a: 10, b: 10}; }
+fn ret_ext_rec() -> @A { return @A {a: 10, b: 10}; }
 
-fn ret_ext_mem() -> {a: @int, b: @int} { return {a: @10, b: @10}; }
+fn ret_ext_mem() -> Abox { return Abox {a: @10, b: @10}; }
 
-fn ret_ext_ext_mem() -> @{a: @int, b: @int} { return @{a: @10, b: @10}; }
+fn ret_ext_ext_mem() -> @Abox { return @Abox{a: @10, b: @10}; }
 
 fn main() {
     let mut int_i: int;
     let mut ext_i: @int;
-    let mut int_rec: {a: int, b: int};
-    let mut ext_rec: @{a: int, b: int};
-    let mut ext_mem: {a: @int, b: @int};
-    let mut ext_ext_mem: @{a: @int, b: @int};
+    let mut int_rec: A;
+    let mut ext_rec: @A;
+    let mut ext_mem: Abox;
+    let mut ext_ext_mem: @Abox;
     int_i = ret_int_i(); // initializing
 
     int_i = ret_int_i(); // non-initializing
index ea16f005c6b3b97ca75ebbf0af8ac648d9cfbed1..2821ab3e3ebc82961de0dce337a84765f23ab7b4 100644 (file)
@@ -8,11 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn magic(+x: {a: @int}) { log(debug, x); }
+fn magic(+x: A) { log(debug, x); }
 fn magic2(+x: @int) { log(debug, x); }
 
+struct A { a: @int }
+
 fn main() {
-    let a = {a: @10}, b = @10;
-    magic(a); magic({a: @20});
+    let a = {a: @10}, b = @10;
+    magic(a); magic({a: @20});
     magic2(b); magic2(@20);
 }
index f3801dcc96d708021093169ad3941185e892af8e..572720f58085a9dbe15e42b2ca1dffae9e55502d 100644 (file)
 
 // Testing that calling fmt! (via debug!) doesn't complain about impure borrows
 
+struct Big { b: @~str, c: uint, d: int, e: char,
+            f: float, g: bool }
+
 pure fn foo() {
-    let a = {
-        b: @"hi",
+    let a = Big {
+        b: @~"hi",
         c: 0,
         d: 1,
         e: 'a',
index ad66bf6dafa24b2afb0dba1f4432d623e2367c29..84792d52c133813fd4d58e1512b6cf4e9c300900 100644 (file)
@@ -29,7 +29,7 @@
 }
 
 pure fn sums_to_using_rec(v: ~[int], sum: int) -> bool {
-    let mut i = 0u, sum0 = {f: 0};
+    let mut i = 0u, sum0 = {f: 0};
     while i < v.len() {
         sum0.f += v[i];
         i += 1u;
     return sum0.f == sum;
 }
 
+struct F<T> { f: T }
+
 pure fn sums_to_using_uniq_rec(v: ~[int], sum: int) -> bool {
-    let mut i = 0u, sum0 = {f: ~mut 0};
+    let mut i = 0u, sum0 = {f: ~mut 0};
     while i < v.len() {
         *sum0.f += v[i];
         i += 1u;
index a81a3891644a655cbc04aff28cb9885df25206a1..5c3f77b994b4e47c8d4c5b37a77654d9d7d8f5dc 100644 (file)
@@ -12,8 +12,8 @@
 
 
 // -*- rust -*-
-type point = {x: int, y: int, z: int};
+struct Point {x: int, y: int, z: int}
 
-fn f(p: point) { assert (p.z == 12); }
+fn f(p: Point) { assert (p.z == 12); }
 
-fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); }
+fn main() { let x: Point = Point {x: 10, y: 11, z: 12}; f(x); }
index d24b0888c44c9fa2276a1a8ffebadaf25a21db4f..11e2f79aa60825ed228cc62fd3bb2177216d2719 100644 (file)
 }
 
 // This is the type with the questionable alignment
-type inner = {
+struct Inner {
     c64: u32
-};
+}
 
 // This is the type that contains the type with the
 // questionable alignment, for testing
-type outer = {
+struct Outer {
     c8: u8,
-    t: inner
-};
+    t: Inner
+}
 
 
 #[cfg(target_arch = "x86")]
@@ -46,21 +46,21 @@ fn size() -> uint { 8u }
 
 fn main() {
     unsafe {
-        let x = {c8: 22u8, t: {c64: 44u32}};
+        let x = Outer {c8: 22u8, t: Inner {c64: 44u32}};
 
         // Send it through the shape code
         let y = fmt!("%?", x);
 
-        debug!("align inner = %?", rusti::min_align_of::<inner>());
-        debug!("size outer = %?", sys::size_of::<outer>());
+        debug!("align inner = %?", rusti::min_align_of::<Inner>());
+        debug!("size outer = %?", sys::size_of::<Outer>());
         debug!("y = %s", y);
 
         // per clang/gcc the alignment of `inner` is 4 on x86.
-        assert rusti::min_align_of::<inner>() == m::align();
+        assert rusti::min_align_of::<Inner>() == m::align();
 
         // per clang/gcc the size of `outer` should be 12
         // because `inner`s alignment was 4.
-        assert sys::size_of::<outer>() == m::size();
+        assert sys::size_of::<Outer>() == m::size();
 
         assert y == ~"{c8: 22, t: {c64: 44}}";
     }
index dc9fa146ef92cec586fffe43734880dcef54bfa8..5fdabdc360cd91930c18966697fde5a0c7b6d455 100644 (file)
 }
 
 // This is the type with the questionable alignment
-type inner = {
+struct Inner {
     c64: u64
-};
+}
 
 // This is the type that contains the type with the
 // questionable alignment, for testing
-type outer = {
+struct Outer {
     c8: u8,
-    t: inner
-};
+    t: Inner
+}
 
 
 #[cfg(target_os = "linux")]
@@ -63,21 +63,21 @@ fn size() -> uint { 16u }
 
 fn main() {
     unsafe {
-        let x = {c8: 22u8, t: {c64: 44u64}};
+        let x = Outer {c8: 22u8, t: Inner {c64: 44u64}};
 
         // Send it through the shape code
         let y = fmt!("%?", x);
 
-        debug!("align inner = %?", rusti::min_align_of::<inner>());
-        debug!("size outer = %?", sys::size_of::<outer>());
+        debug!("align inner = %?", rusti::min_align_of::<Inner>());
+        debug!("size outer = %?", sys::size_of::<Outer>());
         debug!("y = %s", y);
 
-        // per clang/gcc the alignment of `inner` is 4 on x86.
-        assert rusti::min_align_of::<inner>() == m::m::align();
+        // per clang/gcc the alignment of `Inner` is 4 on x86.
+        assert rusti::min_align_of::<Inner>() == m::m::align();
 
-        // per clang/gcc the size of `outer` should be 12
-        // because `inner`s alignment was 4.
-        assert sys::size_of::<outer>() == m::m::size();
+        // per clang/gcc the size of `Outer` should be 12
+        // because `Inner`s alignment was 4.
+        assert sys::size_of::<Outer>() == m::m::size();
 
         assert y == ~"{c8: 22, t: {c64: 44}}";
     }
index 8fab506a49ecee89f50d9d55c29491654bc42f3e..05428879fd2eb68eeb5be42d9933def923bb4266 100644 (file)
 // -*- rust -*-
 
 // Issue #50.
+
+struct X { foo: ~str, bar: ~str }
+
 fn main() {
-    let x = {foo: ~"hello", bar: ~"world"};
+    let x = {foo: ~"hello", bar: ~"world"};
     log(debug, copy x.foo);
     log(debug, copy x.bar);
 }
index 317752d9d4749d9406593b1d4133e38e6bcd6918..ca353455c13726f1ab8048368d17c001904c5c05 100644 (file)
 
 
 // -*- rust -*-
-type point = {x: int, y: int};
+struct Point {x: int, y: int}
 
 fn main() {
-    let origin: point = {x: 0, y: 0};
-    let right: point = {x: origin.x + 10,.. origin};
-    let up: point = {y: origin.y + 10,.. origin};
+    let origin: Point = Point {x: 0, y: 0};
+    let right: Point = Point {x: origin.x + 10,.. origin};
+    let up: Point = Point {y: origin.y + 10,.. origin};
     assert (origin.x == 0);
     assert (origin.y == 0);
     assert (right.x == 10);
index 254ce630338cd5c6570fd0a6d2171c0154504bea..8c20e4f342ba60f33b8c98a7c759d6149536424d 100644 (file)
@@ -9,12 +9,12 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type point = {x: int, y: int};
+struct Point {x: int, y: int}
 
-type rect = (point, point);
+type rect = (Point, Point);
 
-fn fst(r: rect) -> point { let (fst, _) = r; return fst; }
-fn snd(r: rect) -> point { let (_, snd) = r; return snd; }
+fn fst(r: rect) -> Point { let (fst, _) = r; return fst; }
+fn snd(r: rect) -> Point { let (_, snd) = r; return snd; }
 
 fn f(r: rect, x1: int, y1: int, x2: int, y2: int) {
     assert (fst(r).x == x1);
@@ -24,7 +24,7 @@ fn f(r: rect, x1: int, y1: int, x2: int, y2: int) {
 }
 
 fn main() {
-    let r: rect = ({x: 10, y: 20}, {x: 11, y: 22});
+    let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22});
     assert (fst(r).x == 10);
     assert (fst(r).y == 20);
     assert (snd(r).x == 11);
index 8b4f3780be00b5715d2722fc9afd077bb2cb45a4..6ff3635587514192869d583f94a941f87044d702 100644 (file)
@@ -12,9 +12,9 @@
 
 
 // -*- rust -*-
-type rect = {x: int, y: int, w: int, h: int};
+struct Rect {x: int, y: int, w: int, h: int}
 
-fn f(r: rect, x: int, y: int, w: int, h: int) {
+fn f(r: Rect, x: int, y: int, w: int, h: int) {
     assert (r.x == x);
     assert (r.y == y);
     assert (r.w == w);
@@ -22,12 +22,12 @@ fn f(r: rect, x: int, y: int, w: int, h: int) {
 }
 
 fn main() {
-    let r: rect = {x: 10, y: 20, w: 100, h: 200};
+    let r: Rect = Rect {x: 10, y: 20, w: 100, h: 200};
     assert (r.x == 10);
     assert (r.y == 20);
     assert (r.w == 100);
     assert (r.h == 200);
-    let r2: rect = r;
+    let r2: Rect = r;
     let x: int = r2.x;
     assert (x == 10);
     f(r, 10, 20, 100, 200);
index a88a1d1459c498d411280c773ef95ed77c17710a..026b9c93203fa4930aa48a0e02ef44c92fe18d64 100644 (file)
@@ -9,17 +9,17 @@
 // except according to those terms.
 
 enum t1 { a(int), b(uint), }
-type t2 = {x: t1, y: int};
-enum t3 { c(t2, uint), }
+struct T2 {x: t1, y: int}
+enum t3 { c(T2, uint), }
 
 fn m(in: t3) -> int {
     match in {
-      c({x: a(m), _}, _) => { return m; }
-      c({x: b(m), y: y}, z) => { return ((m + z) as int) + y; }
+      c(T2 {x: a(m), _}, _) => { return m; }
+      c(T2 {x: b(m), y: y}, z) => { return ((m + z) as int) + y; }
     }
 }
 
 fn main() {
-    assert (m(c({x: a(10), y: 5}, 4u)) == 10);
-    assert (m(c({x: b(10u), y: 5}, 4u)) == 19);
+    assert (m(c(T2 {x: a(10), y: 5}, 4u)) == 10);
+    assert (m(c(T2 {x: b(10u), y: 5}, 4u)) == 19);
 }
index ff9e133fe153eb27dcc2832422195119d77b3a66..d072df4d8e880f88cc5b76679226e72b963ee2c3 100644 (file)
@@ -29,9 +29,7 @@ fn align(size: uint, align: uint) -> uint {
     ((size + align) - 1u) & !(align - 1u)
 }
 
-enum ptr_visit_adaptor<V: TyVisitor movable_ptr> = {
-    inner: V
-};
+enum ptr_visit_adaptor<V: TyVisitor movable_ptr> = Inner<V>;
 
 impl<V: TyVisitor movable_ptr> ptr_visit_adaptor<V> {
 
@@ -469,11 +467,13 @@ fn visit_closure_ptr(ck: uint) -> bool {
     }
 }
 
-enum my_visitor = @{
+enum my_visitor = @Stuff;
+
+struct Stuff {
     mut ptr1: *c_void,
     mut ptr2: *c_void,
     mut vals: ~[~str]
-};
+}
 
 impl my_visitor {
     fn get<T>(f: fn(T)) {
@@ -485,13 +485,15 @@ fn get<T>(f: fn(T)) {
     fn visit_inner(inner: *TyDesc) -> bool {
         unsafe {
             let u = my_visitor(*self);
-            let v = ptr_visit_adaptor({inner: u});
+            let v = ptr_visit_adaptor::<my_visitor>(Inner {inner: u});
             visit_tydesc(inner, v as TyVisitor);
             true
         }
     }
 }
 
+struct Inner<V> { inner: V }
+
 impl my_visitor: movable_ptr {
     fn move_ptr(adjustment: fn(*c_void) -> *c_void) {
         self.ptr1 = adjustment(self.ptr1);
@@ -622,14 +624,16 @@ fn get_tydesc_for<T>(&&_t: T) -> *TyDesc {
     get_tydesc::<T>()
 }
 
+struct Triple { x: int, y: int, z: int }
+
 fn main() {
     unsafe {
-        let r = (1,2,3,true,false,{x:5,y:4,z:3});
+        let r = (1,2,3,true,false, Triple {x:5,y:4,z:3});
         let p = ptr::addr_of(&r) as *c_void;
-        let u = my_visitor(@{mut ptr1: p,
+        let u = my_visitor(@Stuff {mut ptr1: p,
                              mut ptr2: p,
                              mut vals: ~[]});
-        let v = ptr_visit_adaptor({inner: u});
+        let v = ptr_visit_adaptor(Inner {inner: u});
         let td = get_tydesc_for(r);
         unsafe { error!("tydesc sz: %u, align: %u",
                         (*td).size, (*td).align); }
index b8c0bfeb763a7dad90831e4e9f90973b5ad80c84..e1d54f33dcb780f10b7ebfa82bb79482c4b59890 100644 (file)
@@ -8,14 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type point = {x: int, y: int};
+struct Point {x: int, y: int}
 
-fn x_coord(p: &r/point) -> &r/int {
+fn x_coord(p: &r/Point) -> &r/int {
     return &p.x;
 }
 
 fn main() {
-    let p = @{x: 3, y: 4};
+    let p = @Point {x: 3, y: 4};
     let xc = x_coord(p);
     assert *xc == 3;
 }
index 0fd1b361b2973e6f27f21db7a7f0dfcf358e3e8e..71bf0ac826982a92c1d263bedbd5f81dcede8139 100644 (file)
 use libc, sys, cast;
 use std::arena::Arena;
 
-type bcx = {
-    fcx: &fcx
-};
+struct Bcx {
+    fcx: &Fcx
+}
 
-type fcx = {
+struct Fcx {
     arena: &Arena,
-    ccx: &ccx
-};
+    ccx: &Ccx
+}
 
-type ccx = {
+struct Ccx {
     x: int
-};
+}
 
-fn h(bcx : &r/bcx) -> &r/bcx {
-    return bcx.fcx.arena.alloc(|| { fcx: bcx.fcx });
+fn h(bcx : &r/Bcx) -> &r/Bcx {
+    return bcx.fcx.arena.alloc(|| Bcx { fcx: bcx.fcx });
 }
 
-fn g(fcx : &fcx) {
-    let bcx = { fcx: fcx };
+fn g(fcx : &Fcx) {
+    let bcx = Bcx { fcx: fcx };
     h(&bcx);
 }
 
-fn f(ccx : &ccx) {
+fn f(ccx : &Ccx) {
     let a = Arena();
-    let fcx = &{ arena: &a, ccx: ccx };
+    let fcx = &Fcx { arena: &a, ccx: ccx };
     return g(fcx);
 }
 
 fn main() {
-    let ccx = { x: 0 };
+    let ccx = Ccx { x: 0 };
     f(&ccx);
 }
 
index 09de165002795579906b804d5bd50e4de9461a66..2ef63af3be195cfe18593f4152068f49f934e013 100644 (file)
 
 enum arena = ();
 
-type bcx = {
-    fcx: &fcx
-};
+struct Bcx {
+    fcx: &Fcx
+}
 
-type fcx = {
+struct Fcx {
     arena: &arena,
-    ccx: &ccx
-};
+    ccx: &Ccx
+}
 
-type ccx = {
+struct Ccx {
     x: int
-};
+}
 
-fn alloc(_bcx : &arena) -> &bcx {   
+fn alloc(_bcx : &arena) -> &Bcx {   
     unsafe {
         return cast::reinterpret_cast(
-            &libc::malloc(sys::size_of::<bcx/&blk>() as libc::size_t));
+            &libc::malloc(sys::size_of::<Bcx/&blk>() as libc::size_t));
     }
 }
 
-fn h(bcx : &bcx) -> &bcx {
+fn h(bcx : &Bcx) -> &Bcx {
     return alloc(bcx.fcx.arena);
 }
 
-fn g(fcx : &fcx) {
-    let bcx = { fcx: fcx };
+fn g(fcx : &Fcx) {
+    let bcx = Bcx { fcx: fcx };
     let bcx2 = h(&bcx);
     unsafe {
         libc::free(cast::reinterpret_cast(&bcx2));
     }
 }
 
-fn f(ccx : &ccx) {
+fn f(ccx : &Ccx) {
     let a = arena(());
-    let fcx = { arena: &a, ccx: ccx };
+    let fcx = Fcx { arena: &a, ccx: ccx };
     return g(&fcx);
 }
 
 fn main() {
-    let ccx = { x: 0 };
+    let ccx = Ccx { x: 0 };
     f(&ccx);
 }
 
index 9d1a37ce1528b5f789c02cb64023befb9811064a..975d96dc4206e483412b4ceb85925edb8dba26e4 100644 (file)
@@ -8,18 +8,18 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type clam = { chowder: &int };
+struct Clam { chowder: &int }
 
 trait get_chowder {
     fn get_chowder() -> &self/int;
 }
 
-impl clam: get_chowder {
+impl Clam: get_chowder {
     fn get_chowder() -> &self/int { return self.chowder; }
 }
 
 fn main() {
-    let clam = { chowder: &3 };
+    let clam = Clam { chowder: &3 };
     log(debug, *clam.get_chowder());
     clam.get_chowder();
 }
index 356e0a6c9f2838f4b7aa282b6d02b0c1ee670904..575fefa9db510b4fd11c74f24098282fb1013623 100644 (file)
@@ -8,16 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type ctxt = { v: uint };
+struct Ctxt { v: uint }
 
 trait get_ctxt {
-    fn get_ctxt() -> &self/ctxt;
+    fn get_ctxt() -> &self/Ctxt;
 }
 
-type has_ctxt = { c: &ctxt };
+struct HasCtxt { c: &Ctxt }
 
-impl has_ctxt: get_ctxt {
-    fn get_ctxt() -> &self/ctxt {
+impl HasCtxt: get_ctxt {
+    fn get_ctxt() -> &self/Ctxt {
         self.c
     }
 }
@@ -27,8 +27,8 @@ fn get_v(gc: get_ctxt) -> uint {
 }
 
 fn main() {
-    let ctxt = { v: 22u };
-    let hc = { c: &ctxt };
+    let ctxt = Ctxt { v: 22 };
+    let hc = HasCtxt { c: &ctxt };
 
-    assert get_v(hc as get_ctxt) == 22u;
+    assert get_v(hc as get_ctxt) == 22;
 }
index 80aaad5c90fa6538c29acb8b70247545143459b8..f2926c5e1c5c9dcde20728ac51a2172c758f6753 100644 (file)
@@ -34,10 +34,12 @@ fn r(v: *int) -> r {
     }
 }
 
-enum t = {
+enum t = Node;
+
+struct Node {
     mut next: Option<@t>,
     r: r
-};
+}
 
 fn main() {
     unsafe {
@@ -48,7 +50,7 @@ fn main() {
         let i2p = cast::reinterpret_cast(&i2);
         cast::forget(move i2);
 
-        let x1 = @t({
+        let x1 = @t(Node{
             mut next: None,
               r: {
               let rs = r(i1p);
@@ -61,7 +63,7 @@ fn main() {
             cast::reinterpret_cast::<@t, uint>(&x1),
             cast::reinterpret_cast::<*r, uint>(&ptr::addr_of(&(x1.r))));
 
-        let x2 = @t({
+        let x2 = @t(Node{
             mut next: None,
               r: {
               let rs = r(i2p);
index 3a1f6d812a8e86a7360135edd80fdc474be9b05c..56ca229b0555331fe34839b2aaca35b437973ac0 100644 (file)
 
 // Don't leak the unique pointers
 
-type u = {
+struct U {
     a: int,
     b: int,
     c: *int
-};
+}
 
 struct r {
-  v: u,
+  v: U,
 }
 
 impl r : Drop {
@@ -28,16 +28,18 @@ fn finalize(&self) {
     }
 }
 
-fn r(v: u) -> r {
+fn r(v: U) -> r {
     r {
         v: v
     }
 }
 
-enum t = {
+enum t = Node;
+
+struct Node {
     mut next: Option<@t>,
     r: r
-};
+}
 
 fn main() {
     unsafe {
@@ -48,14 +50,14 @@ fn main() {
         let i2p = cast::reinterpret_cast(&i2);
         cast::forget(move i2);
 
-        let u1 = {a: 0xB, b: 0xC, c: i1p};
-        let u2 = {a: 0xB, b: 0xC, c: i2p};
+        let u1 = {a: 0xB, b: 0xC, c: i1p};
+        let u2 = {a: 0xB, b: 0xC, c: i2p};
 
-        let x1 = @t({
+        let x1 = @t(Node {
             mut next: None,
             r: r(u1)
         });
-        let x2 = @t({
+        let x2 = @t(Node {
             mut next: None,
             r: r(u2)
         });
index 7a4e9e6faf529f6b4292300479ea98d0bcea8a9b..59a6d703c7ce3a1a92c58c81c84c5a0e0acac550 100644 (file)
 
 // Don't leak the unique pointers
 
-type u = {
+struct U {
     a: int,
     b: int,
     c: *int
-};
+}
 
-struct r {
-  v: u,
+struct R {
+  v: U,
   w: int,
   x: *int,
 }
 
-impl r : Drop {
+impl R : Drop {
     fn finalize(&self) {
         unsafe {
             let _v2: ~int = cast::reinterpret_cast(&self.v.c);
@@ -33,9 +33,9 @@ fn finalize(&self) {
     }
 }
 
-fn r(v: u, w: int, _x: *int) -> r {
+fn r(v: U, w: int, _x: *int) -> R {
     unsafe {
-        r {
+        R {
             v: v,
             w: w,
             x: cast::reinterpret_cast(&0)
@@ -43,10 +43,12 @@ fn r(v: u, w: int, _x: *int) -> r {
     }
 }
 
-enum t = {
+enum t = Node;
+
+struct Node {
     mut next: Option<@t>,
-    r: r
-};
+    r: R
+}
 
 fn main() { 
     unsafe {
@@ -57,14 +59,14 @@ fn main() {
         let i2p = cast::reinterpret_cast(&i2);
         cast::forget(move i2);
 
-        let u1 = {a: 0xB, b: 0xC, c: i1p};
-        let u2 = {a: 0xB, b: 0xC, c: i2p};
+        let u1 = {a: 0xB, b: 0xC, c: i1p};
+        let u2 = {a: 0xB, b: 0xC, c: i2p};
 
-        let x1 = @t({
+        let x1 = @t(Node{
             mut next: None,
             r: r(u1, 42, i1p)
         });
-        let x2 = @t({
+        let x2 = @t(Node{
             mut next: None,
             r: r(u2, 42, i2p)
         });
index c96ee8ddce7d9472654543a9d58701ab49a3117b..e528cd32974ba54d5da36f51958dbc65883c1f15 100644 (file)
 // xfail-fast
 #[legacy_modes];
 
+struct Arg<T> {val: T, fin: extern fn(T)}
+
 struct finish<T: Copy> {
-  arg: {val: T, fin: extern fn(T)},
+  arg: Arg<T>
 }
 
 impl<T: Copy> finish<T> : Drop {
@@ -21,7 +23,7 @@ fn finalize(&self) {
     }
 }
 
-fn finish<T: Copy>(arg: {val: T, fin: extern fn(T)}) -> finish<T> {
+fn finish<T: Copy>(arg: Arg<T>) -> finish<T> {
     finish {
         arg: arg
     }
@@ -31,6 +33,6 @@ fn main() {
     let box = @mut 10;
     fn dec_box(&&i: @mut int) { *i -= 1; }
 
-    { let _i = move finish({val: box, fin: dec_box}); }
+    { let _i = move finish(Arg{val: box, fin: dec_box}); }
     assert (*box == 9);
 }
index 1ddeee336e3c0d4f65d1e261ba3596f5e9191809..2b43fca58b72657c74b3f0025b2ddd269d7301ff 100644 (file)
@@ -14,7 +14,7 @@
 // that has a size that is not a power of two
 
 // A 12-byte unit to ::core::oldcomm::send over the channel
-type record = {val1: u32, val2: u32, val3: u32};
+struct Record {val1: u32, val2: u32, val3: u32}
 
 
 // Assuming that the default buffer size needs to hold 8 units,
@@ -24,7 +24,7 @@
 fn test_init() {
     let myport = ::core::oldcomm::Port();
     let mychan = ::core::oldcomm::Chan(&myport);
-    let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
+    let val: Record = Record {val1: 0u32, val2: 0u32, val3: 0u32};
     ::core::oldcomm::send(mychan, val);
 }
 
@@ -35,7 +35,7 @@ fn test_grow() {
     let myport = ::core::oldcomm::Port();
     let mychan = ::core::oldcomm::Chan(&myport);
     for uint::range(0u, 100u) |i| {
-        let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
+        let val: Record = Record {val1: 0u32, val2: 0u32, val3: 0u32};
         ::core::oldcomm::send(mychan, val);
     }
 }
@@ -53,7 +53,7 @@ fn test_shrink2() {
     let myport = ::core::oldcomm::Port();
     let mychan = ::core::oldcomm::Chan(&myport);
     for uint::range(0u, 100u) |_i| {
-        let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
+        let val: Record = Record {val1: 0u32, val2: 0u32, val3: 0u32};
         ::core::oldcomm::send(mychan, val);
     }
     for uint::range(0u, 100u) |_i| { let x = ::core::oldcomm::recv(myport); }
@@ -65,7 +65,7 @@ fn test_rotate() {
     let myport = ::core::oldcomm::Port();
     let mychan = ::core::oldcomm::Chan(&myport);
     for uint::range(0u, 100u) |i| {
-        let val = {val1: i as u32, val2: i as u32, val3: i as u32};
+        let val = Record {val1: i as u32, val2: i as u32, val3: i as u32};
         ::core::oldcomm::send(mychan, val);
         let x = ::core::oldcomm::recv(myport);
         assert (x.val1 == i as u32);
@@ -78,12 +78,12 @@ fn test_rotate() {
 // Test rotating and growing the buffer when
 // the unit size is not a power of two
 fn test_rotate_grow() {
-    let myport = ::core::oldcomm::Port::<record>();
+    let myport = ::core::oldcomm::Port::<Record>();
     let mychan = ::core::oldcomm::Chan(&myport);
     for uint::range(0u, 10u) |j| {
         for uint::range(0u, 10u) |i| {
-            let val: record =
-                {val1: i as u32, val2: i as u32, val3: i as u32};
+            let val: Record =
+                Record {val1: i as u32, val2: i as u32, val3: i as u32};
             ::core::oldcomm::send(mychan, val);
         }
         for uint::range(0u, 10u) |i| {
index 1a6cf7e04cccad98759802ab8c8e356863956d4a..44165119b0d52a26bee202e7e897c128103a3b65 100644 (file)
 
 fn main() { test05(); }
 
-type pair<A,B> = { a: A, b: B };
+struct Pair<A,B> { a: A, b: B }
 
-fn make_generic_record<A: Copy, B: Copy>(a: A, b: B) -> pair<A,B> {
-    return {a: a, b: b};
+fn make_generic_record<A: Copy, B: Copy>(a: A, b: B) -> Pair<A,B> {
+    return Pair {a: a, b: b};
 }
 
-fn test05_start(&&f: fn~(&&v: float, &&v: ~str) -> pair<float, ~str>) {
+fn test05_start(&&f: fn~(&&v: float, &&v: ~str) -> Pair<float, ~str>) {
     let p = f(22.22f, ~"Hi");
     log(debug, copy p);
     assert p.a == 22.22f;
@@ -36,8 +36,8 @@ fn test05_start(&&f: fn~(&&v: float, &&v: ~str) -> pair<float, ~str>) {
     assert q.b == ~"Ho";
 }
 
-fn spawn<A: Copy, B: Copy>(f: extern fn(fn~(A,B)->pair<A,B>)) {
-    let arg = fn~(a: A, b: B) -> pair<A,B> {
+fn spawn<A: Copy, B: Copy>(f: extern fn(fn~(A,B)->Pair<A,B>)) {
+    let arg = fn~(a: A, b: B) -> Pair<A,B> {
         return make_generic_record(a, b);
     };
     task::spawn(|| f(arg) );
index 4139aedf88137e42cde5e72874e6e6215ad33610..53a09b385b3cd5f2580d3246cfa19257eb686669 100644 (file)
@@ -22,21 +22,23 @@ enum opt_span {
 
     //hack (as opposed to option), to make `span` compile
     os_none,
-    os_some(@span),
+    os_some(@Span),
 }
-type span = {lo: uint, hi: uint, expanded_from: opt_span};
-type spanned<T> = { data: T, span: span };
+struct Span {lo: uint, hi: uint, expanded_from: opt_span}
+struct Spanned<T> { data: T, span: Span }
 type ty_ = uint;
-type path_ = { global: bool, idents: ~[~str], types: ~[@ty] };
-type path = spanned<path_>;
-type ty = spanned<ty_>;
+struct Path_ { global: bool, idents: ~[~str], types: ~[@ty] }
+type path = Spanned<Path_>;
+type ty = Spanned<ty_>;
+
+struct X { sp: Span, path: path }
 
 fn main() {
-    let sp: span = {lo: 57451u, hi: 57542u, expanded_from: os_none};
-    let t: @ty = @{ data: 3u, span: sp };
-    let p_: path_ = { global: true, idents: ~[~"hi"], types: ~[t] };
-    let p: path = { data: p_, span: sp };
-    let x = { sp: sp, path: p };
+    let sp: Span = Span {lo: 57451u, hi: 57542u, expanded_from: os_none};
+    let t: @ty = @Spanned { data: 3u, span: sp };
+    let p_: Path_ = Path_ { global: true, idents: ~[~"hi"], types: ~[t] };
+    let p: path = Spanned { data: p_, span: sp };
+    let x = { sp: sp, path: p };
     log(error, copy x.path);
     log(error, copy x);
 }
index c4e38a1de2ce2570458e1538e45b992aad02aa7d..e09150eac767e242ce153d6bccac967d3bb92900 100644 (file)
@@ -8,19 +8,19 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type quad = { a: u64, b: u64, c: u64, d: u64 };
-type floats = { a: f64, b: u8, c: f64 };
+struct Quad { a: u64, b: u64, c: u64, d: u64 }
+struct Floats { a: f64, b: u8, c: f64 }
 
 #[nolink]
 extern mod rustrt {
     #[legacy_exports];
-    fn debug_abi_1(++q: quad) -> quad;
-    fn debug_abi_2(++f: floats) -> floats;
+    fn debug_abi_1(++q: Quad) -> Quad;
+    fn debug_abi_2(++f: Floats) -> Floats;
 }
 
 fn test1() {
     unsafe {
-        let q = { a: 0xaaaa_aaaa_aaaa_aaaa_u64,
+        let q = Quad { a: 0xaaaa_aaaa_aaaa_aaaa_u64,
                  b: 0xbbbb_bbbb_bbbb_bbbb_u64,
                  c: 0xcccc_cccc_cccc_cccc_u64,
                  d: 0xdddd_dddd_dddd_dddd_u64 };
@@ -39,7 +39,7 @@ fn test1() {
 #[cfg(target_arch = "x86_64")]
 fn test2() {
     unsafe {
-        let f = { a: 1.234567890e-15_f64,
+        let f = Floats { a: 1.234567890e-15_f64,
                  b: 0b_1010_1010_u8,
                  c: 1.0987654321e-15_f64 };
         let ff = rustrt::debug_abi_2(f);
index 767887319470df517e14f983de0316b8489f4929..83e34ba84e168776ecb7b091380ef8df5e90da82 100644 (file)
 
 // Tests of ports and channels on various types
 fn test_rec() {
-    type r = {val0: int, val1: u8, val2: char};
+    struct R {val0: int, val1: u8, val2: char}
 
     let (po, ch) = pipes::stream();
-    let r0: r = {val0: 0, val1: 1u8, val2: '2'};
+    let r0: R = R {val0: 0, val1: 1u8, val2: '2'};
     ch.send(r0);
-    let mut r1: r;
+    let mut r1: R;
     r1 = po.recv();
     assert (r1.val0 == 0);
     assert (r1.val1 == 1u8);
index 96c51e980050ab66af0dfcdba3b53d3098f4cf24..cbc093fcc192f1291bd447e175371dbd37fcc4b6 100644 (file)
 
 // Test cyclic detector when using trait instances.
 
-enum Tree = TreeR;
-type TreeR = @{
+enum Tree = @TreeR;
+struct TreeR {
     mut left: Option<Tree>,
     mut right: Option<Tree>,
     val: to_str
-};
+}
 
 trait to_str {
     fn to_str() -> ~str;
@@ -45,10 +45,10 @@ fn to_str() -> ~str {
 fn foo<T: to_str>(x: T) -> ~str { x.to_str() }
 
 fn main() {
-    let t1 = Tree(@{mut left: None,
+    let t1 = Tree(@TreeR{mut left: None,
                     mut right: None,
                     val: 1 as to_str });
-    let t2 = Tree(@{mut left: Some(t1),
+    let t2 = Tree(@TreeR{mut left: Some(t1),
                     mut right: Some(t1),
                     val: 2 as to_str });
     let expected = ~"[2, some([1, none, none]), some([1, none, none])]";
index 866f4742f4e825ce9668d931ab20b41aeb73db42..4215a8597f2c9c7cfc6d8b232f08a147a8fd460e 100644 (file)
@@ -8,8 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-type a = {a: int};
+struct A { a: int }
 
-fn a(a: a) -> int { return a.a; }
+fn a(a: A) -> int { return a.a; }
 
-fn main() { let x: a = {a: 1}; assert (a(x) == 1); }
+fn main() { let x: A = A {a: 1}; assert (a(x) == 1); }
index b78c78ad9e9820ea5d5c56a30e5c62964ffe45b0..b1cde5b2e85fc180b86182e6b3f4a9524c97ac17 100644 (file)
 
 enum maybe_pointy {
     none,
-    p(@pointy),
+    p(@Pointy),
 }
 
-type pointy = {
+struct Pointy {
     mut a : maybe_pointy,
     d : fn~() -> uint,
-};
+}
 
 fn make_uniq_closure<A:Owned Copy>(a: A) -> fn~() -> uint {
     fn~() -> uint { ptr::addr_of(&a) as uint }
 }
 
-fn empty_pointy() -> @pointy {
-    return @{
+fn empty_pointy() -> @Pointy {
+    return @Pointy {
         mut a : none,
         d : make_uniq_closure(~"hi")
     }
index 84a0dc212e56b3695fb7d2b58eab251fe04ff2f2..deaf09a23929bea71ca912b998ea381cc3c5c5e4 100644 (file)
 
 enum maybe_pointy {
     none,
-    p(@pointy),
+    p(@Pointy),
 }
 
-type pointy = {
+struct Pointy {
     mut a : maybe_pointy,
     c : ~int,
     d : fn~()->(),
-};
+}
 
-fn empty_pointy() -> @pointy {
-    return @{
+fn empty_pointy() -> @Pointy {
+    return @Pointy {
         mut a : none,
         c : ~22,
         d : fn~()->(){},
index 78dd7b480204394c205ceccafff63344252f3ffa..d53d89457f18cf5a4743d501e18bd21252d2ba36 100644 (file)
@@ -8,8 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct J { j: int }
+
 fn main() {
-    let i = ~{
+    let i = ~{
         j: 100
     };
     assert i.j == 100;
index 76aa0d85439e5e13350e248a5782a18d7dac939f..5f88a9fce0323b4a04a9c4319100648183218528 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct Foo { a: int, b: int }
+
 fn main() {
-    let ~{a, b} = ~{a: 100, b: 200};
+    let ~Foo{a, b} = ~Foo{a: 100, b: 200};
     assert a + b == 300;
 }
\ No newline at end of file
index ed885045e4b1fb35b5a92fdbcea183fa80d8f31e..48c90d3ba63448a0c68c0474deb0c347513e9234 100644 (file)
@@ -9,12 +9,13 @@
 // except according to those terms.
 
 
-type foo = {a: int, b: uint};
-enum bar { u(~foo), w(int), }
+struct Foo {a: int, b: uint}
+
+enum bar { u(~Foo), w(int), }
 
 fn main() {
-    assert (match u(~{a: 10, b: 40u}) {
-              u(~{a: a, b: b}) => { a + (b as int) }
+    assert (match u(~Foo{a: 10, b: 40u}) {
+              u(~Foo{a: a, b: b}) => { a + (b as int) }
               _ => { 66 }
             } == 50);
 }
index e92547ac89c698c9a0279a2c6e78682886dfe047..4beaa080f8b9e64cb7db4fa7c09c0e185cd10c1e 100644 (file)
@@ -8,9 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+struct X { x: int }
 
 fn main() {
-    let x = ~{x: 1};
+    let x = ~{x: 1};
     let bar = x;
     assert bar.x == 1;
 }
index 02e6276105f0af4d0bab8d6dba1c61d9454a95da..f7d7c1474f792f18f6257d080258b2a3f98cb716 100644 (file)
 
 
 
+struct Pair { x: int, y: int }
+
 fn main() {
     // This just tests whether the vec leaks its members.
 
-    let pvec: ~[@{x: int, y: int}] =
-        ~[@{x: 1, y: 2}, @{x: 3, y: 4}, @{x: 5, y: 6}];
+    let pvec: ~[@Pair] =
+        ~[@Pair{x: 1, y: 2}, @Pair{x: 3, y: 4}, @Pair{x: 5, y: 6}];
 }
index 3857cbfb022ea79ef7efa65aed936b9d77c23e62..6d93f837affc4ae122e5c4c2b7d9f449c16266d3 100644 (file)
 
 
 // -*- rust -*-
-type point = {x: int, y: int, mut z: int};
+struct Point {x: int, y: int, mut z: int}
 
-fn f(p: &mut point) { p.z = 13; }
+fn f(p: &mut Point) { p.z = 13; }
 
 fn main() {
-    let mut x: point = {x: 10, y: 11, mut z: 12};
+    let mut x: Point = Point {x: 10, y: 11, mut z: 12};
     f(&mut x);
     assert (x.z == 13);
 }