]> git.lizzy.rs Git - rust.git/commitdiff
Remove the class keyword
authorBrian Anderson <banderson@mozilla.com>
Thu, 16 Aug 2012 01:46:55 +0000 (18:46 -0700)
committerBrian Anderson <banderson@mozilla.com>
Fri, 17 Aug 2012 17:13:45 +0000 (10:13 -0700)
143 files changed:
doc/rust.md
doc/tutorial.md
src/libcore/comm.rs
src/libcore/io.rs
src/libcore/option.rs
src/libcore/priv.rs
src/libcore/rand.rs
src/libcore/run.rs
src/libcore/stackwalk.rs
src/libcore/task.rs
src/libcore/unsafe.rs
src/libcore/util.rs
src/libstd/bitv.rs
src/libstd/c_vec.rs
src/libstd/net_tcp.rs
src/libsyntax/ext/pipes/proto.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/rustc/driver/rustc.rs
src/rustc/lib/llvm.rs
src/rustc/metadata/decoder.rs
src/rustc/middle/lang_items.rs
src/rustc/middle/liveness.rs
src/rustc/middle/resolve3.rs
src/rustc/middle/trans/base.rs
src/rustc/middle/trans/common.rs
src/rustc/middle/typeck/check/method.rs
src/rustc/middle/typeck/coherence.rs
src/rustc/util/common.rs
src/rustdoc/demo.rs
src/test/auxiliary/cci_class.rs
src/test/auxiliary/cci_class_2.rs
src/test/auxiliary/cci_class_3.rs
src/test/auxiliary/cci_class_4.rs
src/test/auxiliary/cci_class_5.rs
src/test/auxiliary/cci_class_6.rs
src/test/auxiliary/cci_class_cast.rs
src/test/auxiliary/issue-2526.rs
src/test/auxiliary/issue-3012-1.rs
src/test/auxiliary/issue2170lib.rs
src/test/auxiliary/test_comm.rs
src/test/bench/task-perf-alloc-unwind.rs
src/test/bench/task-perf-word-count-generic.rs
src/test/compile-fail/assign-to-method.rs
src/test/compile-fail/block-must-not-have-result-res.rs
src/test/compile-fail/borrowck-unary-move-2.rs
src/test/compile-fail/cap-clause-illegal-cap.rs
src/test/compile-fail/class-cast-to-trait.rs
src/test/compile-fail/class-implements-int.rs
src/test/compile-fail/class-method-missing.rs
src/test/compile-fail/class-missing-self.rs
src/test/compile-fail/copy-a-resource.rs
src/test/compile-fail/issue-2063-resource.rs
src/test/compile-fail/issue-2370-2.rs
src/test/compile-fail/issue-2370.rs
src/test/compile-fail/issue-2487-b.rs
src/test/compile-fail/issue-2509-a.rs
src/test/compile-fail/issue-2718-a.rs
src/test/compile-fail/issue-2825-b.rs
src/test/compile-fail/issue-2825.rs
src/test/compile-fail/issue-3021-b.rs
src/test/compile-fail/lint-non-camel-case-class.rs
src/test/compile-fail/liveness-ctor-access-self-with-uninit-fields.rs
src/test/compile-fail/liveness-ctor-field-never-init.rs
src/test/compile-fail/liveness-ctor-uninit-field.rs
src/test/compile-fail/liveness-ctor-uninit-var.rs
src/test/compile-fail/liveness-unused.rs
src/test/compile-fail/mutable-class-fields-2.rs
src/test/compile-fail/mutable-class-fields.rs
src/test/compile-fail/no-send-res-ports.rs
src/test/compile-fail/non-const.rs
src/test/compile-fail/noncopyable-class.rs
src/test/compile-fail/pinned-deep-copy.rs
src/test/compile-fail/private-class-field.rs
src/test/compile-fail/private-method.rs
src/test/compile-fail/record-with-resource.rs
src/test/compile-fail/regions-addr-of-self.rs
src/test/compile-fail/regions-addr-of-upvar-self.rs
src/test/compile-fail/regions-bounds.rs
src/test/compile-fail/regions-in-rsrcs.rs
src/test/compile-fail/tps-invariant-class.rs
src/test/compile-fail/unique-pinned-nocopy.rs
src/test/compile-fail/unique-vec-res.rs
src/test/compile-fail/unsendable-class.rs
src/test/compile-fail/vec-res-add.rs
src/test/run-fail/morestack2.rs
src/test/run-fail/morestack3.rs
src/test/run-fail/morestack4.rs
src/test/run-fail/rt-set-exit-status-fail2.rs
src/test/run-fail/unwind-box-res.rs
src/test/run-pass/binops.rs
src/test/run-pass/boxed-class-type-substitution.rs
src/test/run-pass/class-attributes-2.rs
src/test/run-pass/class-cast-to-trait-multiple-types.rs
src/test/run-pass/class-cast-to-trait.rs
src/test/run-pass/class-dtor.rs
src/test/run-pass/class-exports.rs
src/test/run-pass/class-impl-very-parameterized-trait.rs
src/test/run-pass/class-implement-trait-cross-crate.rs
src/test/run-pass/class-implement-traits.rs
src/test/run-pass/class-methods.rs
src/test/run-pass/class-poly-methods.rs
src/test/run-pass/class-separate-impl.rs
src/test/run-pass/class-str-field.rs
src/test/run-pass/class-typarams.rs
src/test/run-pass/classes-self-referential.rs
src/test/run-pass/classes-simple-method.rs
src/test/run-pass/classes-simple.rs
src/test/run-pass/classes.rs
src/test/run-pass/conditional-compile.rs
src/test/run-pass/init-res-into-things.rs
src/test/run-pass/issue-2288.rs
src/test/run-pass/issue-2311-2.rs
src/test/run-pass/issue-2445-b.rs
src/test/run-pass/issue-2445.rs
src/test/run-pass/issue-2487-a.rs
src/test/run-pass/issue-2502.rs
src/test/run-pass/issue-2550.rs
src/test/run-pass/issue-2633.rs
src/test/run-pass/issue-2708.rs
src/test/run-pass/issue-2718.rs
src/test/run-pass/issue-2735-2.rs
src/test/run-pass/issue-2735-3.rs
src/test/run-pass/issue-2748-a.rs
src/test/run-pass/issue-979.rs
src/test/run-pass/nested-class.rs
src/test/run-pass/private-class-field.rs
src/test/run-pass/private-method.rs
src/test/run-pass/resource-assign-is-not-copy.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-destruct.rs
src/test/run-pass/resource-generic.rs
src/test/run-pass/resource-in-struct.rs
src/test/run-pass/send-resource.rs
src/test/run-pass/sendable-class.rs
src/test/run-pass/task-killjoin-rsrc.rs
src/test/run-pass/type-param-constraints.rs
src/test/run-pass/unique-pinned-nocopy-2.rs
src/test/run-pass/unwind-resource.rs
src/test/run-pass/unwind-resource2.rs
src/test/run-pass/vec-slice-drop.rs

index 9d7d9ee473cd5fa7f323fc62fe4c0dd69697f21b..a34c32e1200344032ecd76055ae0657f9a1fc4cf 100644 (file)
@@ -211,7 +211,7 @@ The keywords in [source files](#source-files) are the following strings:
 ~~~~~~~~ {.keyword}
 again assert
 break
-check class const copy
+check const copy
 drop
 else enum export extern
 fail false fn for
@@ -220,6 +220,7 @@ let log loop
 match mod mut
 pure
 return
+struct
 true trait type
 unchecked unsafe
 while
@@ -1097,151 +1098,6 @@ enum list<T> {
 let a: list<int> = cons(7, @cons(13, @nil));
 ~~~~
 
-### Classes
-
-A _class_ is a named record type that collects together fields and
-methods. It must have a _constructor_ (a function called `new` that
-returns a new instance of the class), and may have a destructor (a
-nullary function called `drop` that executes before the memory manager
-frees the memory for a given class). For historical reasons, we may
-call a class with a destructor and a single field a "resource".
-
-A _class item_ declares a class type:
-
-~~~~
-class file_descriptor {
-    let fd: libc::c_int;
-    new(fd: libc::c_int) { self.fd = fd; }
-    drop { libc::close(self.fd); }
-}
-~~~~
-
-Calling the `file_descriptor` constructor function on an integer will
-produce a value with the `file_descriptor` type.
-
-_Fields_ are immutable by default, so instances of `file_descriptor`
-can't have their `fd` fields reassigned. A mutable field declaration
-looks like:
-
-~~~~
-    let mut fd: libc::c_int;
-~~~~
-
-The only exception is that the body of the class constructor begins
-with all the class's fields uninitialized, and is allowed to -- in
-fact, must -- initialize all the fields. The compiler enforces this
-invariant.
-
-Usually, the class constructor stores its argument or arguments in the
-class's named fields. In this case, the `file_descriptor`'s data field
-would be accessed like `f.fd`, if `f` is a value of type
-`file_descriptor`. By default, class fields are _public_: they can be
-accessed both from methods inside the class, and code outside the
-class. Classes can also have private fields:
-
-~~~~
-class file_descriptor {
-    let fd: *libc::FILE;
-    new(fd: *libc::FILE) {
-      self.fd = fd; self.name = none;
-    }
-    priv {
-      let mut name: option<~str>;
-    }
-    fn get_name() -> ~str {
-      match self.name {
-         none    => fail ~"File has no name!",
-         some(n) => n
-      }
-    }
-}
-~~~~
-
-Private fields are instance-private: methods in a class `C` can access
-`self`'s private fields, but not private fields of other values of
-type `C`. Code outside a class can't access any private fields.
-
-A class item may contain _methods_, which take an implicit `self`
-argument:
-
-~~~~
-class file_descriptor {
-    let fd: *libc::FILE;
-    new(fd: *libc::FILE) { self.fd = fd; }
-    fn flush() {
-       libc::fflush(self.fd);
-    }
-}
-~~~~
-
-In this case, ```open``` is a nullary method that calls the
-```fopen``` function, defined in another library, on the ```fd```
-field. As in this example, methods must refer to their self's fields
-as fields of ```self```; bare references to ```fd``` can't
-occur. Methods can be public or private; just like fields, they are
-public by default and private if enclosed in a `priv` section.
-
-Classes may be polymorphic:
-
-~~~~
-class file<A: copy> {
-  let data: A;
-  let fd: *libc::FILE;
-  new(data: A, fd: *libc::FILE) { self.data = data; self.fd = fd; }
-}
-~~~~
-
-Methods may also be polymorphic, and can have additional type
-parameters other than those bound in the class:
-
-~~~~
-class file<A: copy> {
-  let data: A;
-  let fd: *libc::FILE;
-  new(fd: *libc::FILE, data: A) { self.fd = fd; self.data = data; }
-  fn map_data<B>(f: fn(A) -> B) -> B {
-     f(self.data)
-  }
-}
-~~~~
-
-Classes do not support inheritance, except through traits. As a
-result, all class method dispatch is static (non-virtual).
-
-A class may implement a trait (see [traits](#traits)):
-
-~~~~
-trait to_str {
-  fn to_str() -> ~str;
-}
-
-class file : to_str {
-  let fd: *libc::FILE;
-  new(fd: *libc::FILE) { self.fd = fd; }
-  fn to_str() -> ~str { ~"a file" }
-}
-~~~~
-
-The syntax `class file: to_str` is pronounced "class `file`
-implements trait `to_str`".
-
-Class instances may be allocated on the stack, in the exchange heap,
-or on the task heap. A value with a class type ```C``` has a
-noncopyable [type kind](#type-kinds) if ```C``` has a destructor, and
-thus may not be copied. Class types that don't have destructors may be
-copied if all their fields are copyable.
-
-The semantics guarantee that for each constructed resource value, the
-destructor will run once: when the value is disposed of (barring
-drastic program termination that somehow prevents unwinding from
-taking place). For stack-allocated values, disposal happens when the
-value goes out of scope. For values in shared boxes, it happens when
-the reference count of the box reaches zero.
-
-The order of fields in a class instance is significant; its runtime
-representation is the same as that of a record with identical fields
-laid out in the same order.
-
 ### Traits
 
 A _trait item_ describes a set of method types. [_implementation
@@ -1348,7 +1204,7 @@ trait.  The methods in such an implementation can only be used
 statically (as direct calls on the values of the type that the
 implementation targets). In such an implementation, the `of` clause is
 not given, and the name is mandatory.  Such implementations are
-limited to nominal types (enums, classes) and the implementation must
+limited to nominal types (enums, structs) and the implementation must
 appear in the same module or a sub-module as the receiver type.
 
 _When_ a trait is specified, all methods declared as part of the
@@ -2744,9 +2600,9 @@ fn main() {
 In this example, the trait `printable` occurs as a type in both the type signature of
 `print`, and the cast expression in `main`.
 
-### Class types
+### Struct types
 
-Every class item defines a type. See [classes](#classes).
+Every struct item defines a type.
 
 ### Type parameters
 
@@ -2766,7 +2622,7 @@ type `~[B]`, a vector type with element type `B`.
 
 ### Self type
 
-The special type `self` has a meaning within methods inside a class or
+The special type `self` has a meaning within methods inside an
 impl item. It refers to the type of the implicit `self` argument. For
 example, in:
 
@@ -2781,19 +2637,7 @@ impl ~str: printable {
 ~~~~~~
 
 `self` refers to the value of type `str` that is the receiver for a
-call to the method `to_str`. Similarly, in a class declaration:
-
-~~~~~~
-class cat {
-  let mut meows: uint;
-  new() { self.meows = 0; }
-  fn meow() { self.meows = self.meows + 1; }
-}
-~~~~~~
-
-`self` refers to the class instance that is the receiver of the method
-(except in the constructor `new`, where `self` is the class instance
-that the constructor implicitly returns).
+call to the method `to_str`.
 
 ## Type kinds
 
index df1573fc494b1c694b572627dbead20cb09776cc..5a2fce3bc772d6c6824c35ae03e483ded0db8d6a 100644 (file)
@@ -1821,85 +1821,6 @@ fn contains(v: ~[int], elt: int) -> bool {
 
 `for` syntax only works with stack closures.
 
-# Classes
-
-Rust lets users define new types with fields and methods, called 'classes', in
-the style of object-oriented languages.
-
-> ***Warning:*** Rust's classes are in the process of changing rapidly. Some more
-> information about some of the potential changes is [here][classchanges].
-
-[classchanges]: http://pcwalton.github.com/blog/2012/06/03/maximally-minimal-classes-for-rust/
-
-An example of a class:
-
-~~~~
-class example {
-  let mut x: int;
-  let y: int;
-
-  priv {
-    let mut private_member: int;
-    fn private_method() {}
-  }
-
-  new(x: int) {
-    // Constructor
-    self.x = x;
-    self.y = 7;
-    self.private_member = 8;
-  }
-
-  fn a() {
-    io::println(~"a");
-  }
-
-  drop {
-    // Destructor
-    self.x = 0;
-  }
-}
-
-fn main() {
-  let x: example = example(1);
-  let y: @example = @example(2);
-  x.a();
-  x.x = 5;
-}
-~~~~
-
-Fields and methods are declared just like functions and local variables, using
-'fn' and 'let'. As usual, 'let mut' can be used to create mutable fields. At
-minimum, Rust classes must have at least one field.
-
-Rust classes must also have a constructor, and can optionally have a destructor
-as well. The constructor and destructor are declared as shown in the example:
-like methods named 'new' and 'drop', but without 'fn', and without arguments
-for drop.
-
-In the constructor, the compiler will enforce that all fields are initialized
-before doing anything that might allow them to be accessed. This includes
-returning from the constructor, calling any method on 'self', calling any
-function with 'self' as an argument, or taking a reference to 'self'. Mutation
-of immutable fields is possible only in the constructor, and only before doing
-any of these things; afterwards it is an error.
-
-Private fields and methods are declared as shown above, using a `priv { ... }`
-block within the class. They are accessible only from within the same instance
-of the same class. (For example, even from within class A, you cannot call
-private methods, or access private fields, on other instances of class A; only
-on `self`.) This accessibility restriction may change in the future.
-
-As mentioned below, in the section on copying types, classes with destructors
-are considered 'resource' types and are not copyable.
-
-Declaring a class also declares its constructor as a function of the same name.
-You can construct an instance of the class, as in the example, by calling that
-function. The function and the type, though they have the same name, are
-otherwise independent. As with other Rust types, you can use `@` or `~` to
-construct a heap-allocated instance of a class, either shared or unique; just
-call e.g. `@example(...)` as shown above.
-
 # Argument passing
 
 Rust datatypes are not trivial to copy (the way, for example,
index 6452027fa7c4ebf934e73b8874d39b5c8e4ee373..4d67e98d68af0b918fa7475128d35aee30c42114 100644 (file)
@@ -97,7 +97,7 @@ fn listen<T: send, U>(f: fn(Chan<T>) -> U) -> U {
     f(po.chan())
 }
 
-class PortPtr<T:send> {
+struct PortPtr<T:send> {
   let po: *rust_port;
   new(po: *rust_port) { self.po = po; }
   drop unsafe {
@@ -132,7 +132,7 @@ fn listen<T: send, U>(f: fn(Chan<T>) -> U) -> U {
  */
 fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
 
-    class PortRef {
+    struct PortRef {
        let p: *rust_port;
        new(p: *rust_port) { self.p = p; }
        drop {
index d85ffb4981d8a222c987507b091d66666a0c8e61..8ef9556a95846b42ebbef61c938b0e885db501d5 100644 (file)
@@ -237,7 +237,7 @@ fn seek(off: int, whence: SeekStyle) { self.base.seek(off, whence) }
     fn tell() -> uint { self.base.tell() }
 }
 
-class FILERes {
+struct FILERes {
     let f: *libc::FILE;
     new(f: *libc::FILE) { self.f = f; }
     drop { libc::fclose(self.f); }
@@ -415,7 +415,7 @@ fn get_type() -> WriterType {
     }
 }
 
-class FdRes {
+struct FdRes {
     let fd: fd_t;
     new(fd: fd_t) { self.fd = fd; }
     drop { libc::close(self.fd); }
@@ -764,7 +764,7 @@ enum Level {
 
 
     // Artifacts that need to fsync on destruction
-    class Res<t> {
+    struct Res<t> {
         let arg: Arg<t>;
         new(-arg: Arg<t>) { self.arg <- arg; }
         drop {
index e677b9bde00da81cc41657ed865085344c3ec539..c122fb9e46f81e11c728c46f351b0d4a6c9c3fb6 100644 (file)
@@ -264,7 +264,7 @@ fn test_unwrap_str() {
 
 #[test]
 fn test_unwrap_resource() {
-    class r {
+    struct r {
        let i: @mut int;
        new(i: @mut int) { self.i = i; }
        drop { *(self.i) += 1; }
index 1fcc57f503642222ecfade4be61360ae7826517f..c02b094ad36a112ebc8e33424855311709078ca9 100644 (file)
@@ -194,7 +194,7 @@ unsafe fn weaken_task(f: fn(comm::Port<()>)) {
     let _unweaken = Unweaken(ch);
     f(po);
 
-    class Unweaken {
+    struct Unweaken {
       let ch: comm::Chan<()>;
       new(ch: comm::Chan<()>) { self.ch = ch; }
       drop unsafe {
index fa197a365c3bdf6ffaaf5e83fc9924970bde0f6f..cf2a3712b069c1ab5180ad76c85cf140011c972c 100644 (file)
@@ -243,7 +243,7 @@ fn shuffle_mut<T>(&&values: ~[mut T]) {
 
 }
 
-class RandRes {
+struct RandRes {
     let c: *rctx;
     new(c: *rctx) { self.c = c; }
     drop { rustrt::rand_free(self.c); }
index 991c4d8bed2f841b1fabb9107cf6d3b610cc9c77..3ccdc87997d267da49b24723b4f02836d7bff689 100644 (file)
@@ -225,7 +225,7 @@ fn destroy_repr(r: &ProgRepr) {
        libc::fclose(r.out_file);
        libc::fclose(r.err_file);
     }
-    class ProgRes {
+    struct ProgRes {
         let r: ProgRepr;
         new(+r: ProgRepr) { self.r = r; }
         drop { destroy_repr(&self.r); }
index 07c6ae6925e8b56a2789c7a595f6af225ef46fdd..959ee4cf5a8a436888402e2f151533966d1bc662 100644 (file)
@@ -6,7 +6,7 @@
 
 type Word = uint;
 
-class Frame {
+struct Frame {
     let fp: *Word;
 
     new(fp: *Word) {
index 50ff4e0d8a25b489e62ea5b1b4b82c2392fa7938..90dd00d994a6d45a419bc83e0b91b37f98d7d742 100644 (file)
@@ -578,7 +578,7 @@ fn get_task() -> Task {
  * ~~~
  */
 unsafe fn unkillable<U>(f: fn() -> U) -> U {
-    class AllowFailure {
+    struct AllowFailure {
         let t: *rust_task;
         new(t: *rust_task) { self.t = t; }
         drop { rustrt::rust_task_allow_kill(self.t); }
@@ -592,7 +592,7 @@ unsafe fn unkillable<U>(f: fn() -> U) -> U {
 
 /// The inverse of unkillable. Only ever to be used nested in unkillable().
 unsafe fn rekillable<U>(f: fn() -> U) -> U {
-    class DisallowFailure {
+    struct DisallowFailure {
         let t: *rust_task;
         new(t: *rust_task) { self.t = t; }
         drop { rustrt::rust_task_inhibit_kill(self.t); }
@@ -609,7 +609,7 @@ unsafe fn rekillable<U>(f: fn() -> U) -> U {
  * For use with exclusive ARCs, which use pthread mutexes directly.
  */
 unsafe fn atomically<U>(f: fn() -> U) -> U {
-    class DeferInterrupts {
+    struct DeferInterrupts {
         let t: *rust_task;
         new(t: *rust_task) { self.t = t; }
         drop {
@@ -911,7 +911,7 @@ fn with_parent_tg<U>(parent_group: &mut option<TaskGroupArc>,
 }
 
 // One of these per task.
-class Tcb {
+struct Tcb {
     let me:            *rust_task;
     // List of tasks with whose fates this one's is intertwined.
     let tasks:         TaskGroupArc; // 'none' means the group has failed.
@@ -952,7 +952,7 @@ fn with_parent_tg<U>(parent_group: &mut option<TaskGroupArc>,
     }
 }
 
-class AutoNotify {
+struct AutoNotify {
     let notify_chan: comm::Chan<Notification>;
     let mut failed:  bool;
     new(chan: comm::Chan<Notification>) {
index 22cdbacd60f58ccba22a1abdc80f240e5c1c96e2..80fb4dc7d629527d70801892f7e5941b34a05f04 100644 (file)
@@ -74,7 +74,7 @@ unsafe fn transmute_mut_region<T>(+ptr: &a/mut T) -> &b/mut T {
     data: T
 };
 
-class ArcDestruct<T> {
+struct ArcDestruct<T> {
    let data: *libc::c_void;
    new(data: *libc::c_void) { self.data = data; }
    drop unsafe {
@@ -162,7 +162,7 @@ fn rust_atomic_decrement(p: &mut libc::intptr_t)
     fn rust_unlock_little_lock(lock: rust_little_lock);
 }
 
-class LittleLock {
+struct LittleLock {
     let l: rust_little_lock;
     new() {
         self.l = rustrt::rust_create_little_lock();
@@ -173,7 +173,7 @@ fn rust_atomic_decrement(p: &mut libc::intptr_t)
 impl LittleLock {
     #[inline(always)]
     unsafe fn lock<T>(f: fn() -> T) -> T {
-        class Unlock {
+        struct Unlock {
             let l: rust_little_lock;
             new(l: rust_little_lock) { self.l = l; }
             drop { rustrt::rust_unlock_little_lock(self.l); }
index 3eb9474598cb9db96224ce293b5c91378394acbe..c68ee317da4788be2e550c399a1c868905392651 100644 (file)
@@ -33,7 +33,7 @@ fn replace<T>(dest: &mut T, +src: T) -> T {
 }
 
 /// A non-copyable dummy type.
-class NonCopyable {
+struct NonCopyable {
     i: ();
     new() { self.i = (); }
     drop { }
index 3b5d08d0c40c4227c07ce06c4d220876a9c4aaf7..77d39616b61c8f06f7c756182a26e9a322253747 100644 (file)
@@ -19,7 +19,7 @@
 export eq_vec;
 export methods;
 
-class small_bitv {
+struct small_bitv {
     let mut bits: u32;
     new(bits: u32) { self.bits = bits; }
     priv {
@@ -78,7 +78,7 @@ fn is_false() -> bool { self.bits == 0 }
     fn invert() { self.bits = !self.bits; }
 }
 
-class big_bitv {
+struct big_bitv {
 // only mut b/c of clone and lack of other constructor
     let mut storage: ~[mut uint];
     new(-storage: ~[mut uint]) {
@@ -153,7 +153,7 @@ enum a_bitv { big(~big_bitv), small(~small_bitv) }
 enum op {union, intersect, assign, difference}
 
 // The bitvector type
-class bitv {
+struct bitv {
     let rep: a_bitv;
     let nbits: uint;
 
index 8b5a5e551134e2132b85f589b0d92c8ff3ebf80e..0cba532fa579d9bf5c1f1b32fcbadb2dbb2f7ce0 100644 (file)
@@ -42,7 +42,7 @@ enum c_vec<T> {
     c_vec_({ base: *mut T, len: uint, rsrc: @dtor_res})
 }
 
-class dtor_res {
+struct dtor_res {
   let dtor: option<fn@()>;
   new(dtor: option<fn@()>) { self.dtor = dtor; }
   drop {
index e14b15b4eff2e5d56a69d7fc3943759f32b0d1c1..aadbe09bc4e1833067e27f5783635d13aa2863bd 100644 (file)
@@ -38,7 +38,7 @@
  * underlying libuv data structures when it goes out of scope. This is the
  * data structure that is used for read/write operations over a TCP stream.
  */
-class tcp_socket {
+struct tcp_socket {
   let socket_data: @tcp_socket_data;
   new(socket_data: @tcp_socket_data) { self.socket_data = socket_data; }
   drop {
@@ -54,7 +54,7 @@
  * It is created with a call to `net::tcp::socket_buf()` and has impls that
  * satisfy both the `io::reader` and `io::writer` traits.
  */
-class tcp_socket_buf {
+struct tcp_socket_buf {
   let data: @tcp_buffered_socket_data;
   new(data: @tcp_buffered_socket_data) { self.data = data; }
 }
index 100f248a7ad35768ca24b89a399eba89e31946e4..9e44ce7acdad620c60050531d871c501153b2800 100644 (file)
@@ -109,7 +109,7 @@ fn protocol(name: ident, +span: span) -> protocol {
     @protocol_(name, span)
 }
 
-class protocol_ {
+struct protocol_ {
     let name: ident;
     let span: span;
     let states: DVec<state>;
index c714fe59b13ca4672459f16acd99efe1660aaa85..c1e5de487411723c3dc26c17c3a7819042c20800 100644 (file)
@@ -180,7 +180,7 @@ macro_rules! maybe_whole {
 
 /* ident is handled by common.rs */
 
-class parser {
+struct parser {
     let sess: parse_sess;
     let cfg: crate_cfg;
     let file_type: file_type;
@@ -3201,8 +3201,7 @@ fn parse_item_or_view_item(+attrs: ~[attribute], items_allowed: bool)
             return iovi_item(self.mk_item(lo, self.last_span.hi, ident, item_,
                                           visibility,
                                           maybe_append(attrs, extra_attrs)));
-        } else if items_allowed &&
-                (self.eat_keyword(~"class") || self.eat_keyword(~"struct")) {
+        } else if items_allowed && self.eat_keyword(~"struct") {
             let (ident, item_, extra_attrs) = self.parse_item_class();
             return iovi_item(self.mk_item(lo, self.last_span.hi, ident, item_,
                                           visibility,
index a99d071b6ef74055361847bc63c8182bb094d693..0f4d71c281c633b87c39005a740361f3b6717c19 100644 (file)
@@ -335,7 +335,7 @@ fn restricted_keyword_table() -> hashmap<~str, ()> {
     let keys = ~[
         ~"again", ~"assert",
         ~"break",
-        ~"check", ~"class", ~"const", ~"copy",
+        ~"check", ~"const", ~"copy",
         ~"do", ~"drop",
         ~"else", ~"enum", ~"export", ~"extern",
         ~"fail", ~"false", ~"fn", ~"for",
index 134af84866e5bfae7354aa4791d4a4a8c7021dca..f115125647765614c1802c7ca05793050b76e295 100644 (file)
@@ -230,7 +230,7 @@ enum monitor_msg {
             diagnostic::emit(cmsp, msg, lvl);
         };
 
-        class finally {
+        struct finally {
             let ch: comm::Chan<monitor_msg>;
             new(ch: comm::Chan<monitor_msg>) { self.ch = ch; }
             drop { comm::send(self.ch, done); }
index 2250d3d3086b7e56502ac1c81ea48168218c1e35..8f705781adfd429f0e7abd63b962c64c4670f412 100644 (file)
@@ -1122,7 +1122,7 @@ fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] unsafe {
 
 /* Memory-managed interface to target data. */
 
-class target_data_res {
+struct target_data_res {
     let TD: TargetDataRef;
     new(TD: TargetDataRef) { self.TD = TD; }
     drop { llvm::LLVMDisposeTargetData(self.TD); }
@@ -1138,7 +1138,7 @@ fn mk_target_data(string_rep: ~str) -> target_data {
 
 /* Memory-managed interface to pass managers. */
 
-class pass_manager_res {
+struct pass_manager_res {
     let PM: PassManagerRef;
     new(PM: PassManagerRef) { self.PM = PM; }
     drop { llvm::LLVMDisposePassManager(self.PM); }
@@ -1153,7 +1153,7 @@ fn mk_pass_manager() -> pass_manager {
 
 /* Memory-managed interface to object files. */
 
-class object_file_res {
+struct object_file_res {
     let ObjectFile: ObjectFileRef;
     new(ObjectFile: ObjectFileRef) { self.ObjectFile = ObjectFile; }
     drop { llvm::LLVMDisposeObjectFile(self.ObjectFile); }
@@ -1169,7 +1169,7 @@ fn mk_object_file(llmb: MemoryBufferRef) -> option<object_file> {
 
 /* Memory-managed interface to section iterators. */
 
-class section_iter_res {
+struct section_iter_res {
     let SI: SectionIteratorRef;
     new(SI: SectionIteratorRef) { self.SI = SI; }
     drop { llvm::LLVMDisposeSectionIterator(self.SI); }
index 6678b6e036aed983537c84ca9cb9cc0595440d24..c36b99ba9d56d38c7a631aa9ad63f4e8f2e708d7 100644 (file)
@@ -403,7 +403,7 @@ fn def_like_to_def(def_like: def_like) -> ast::def {
 }
 
 // A path.
-class path_entry {
+struct path_entry {
     // The full path, separated by '::'.
     let path_string: ~str;
     // The definition, implementation, or field that this path corresponds to.
index 877dfd5f90c20c950d8cc82baf2d1e596c6ac99f..557ee9661a2ce1c576ef2bb8a0d8e88190cc94ff 100644 (file)
@@ -22,7 +22,7 @@
 import std::map::{hashmap, str_hash};
 import str_eq = str::eq;
 
-class LanguageItems {
+struct LanguageItems {
     let mut const_trait: option<def_id>;
     let mut copy_trait: option<def_id>;
     let mut send_trait: option<def_id>;
@@ -62,7 +62,7 @@
     }
 }
 
-class LanguageItemCollector {
+struct LanguageItemCollector {
     let items: &LanguageItems;
 
     let crate: @crate;
index c89095423c6b5cc48cff736844e7465079176162..321e3db318e769929a505a4d84054a0e2b2dec3b 100644 (file)
@@ -208,7 +208,7 @@ fn relevant_def(def: def) -> option<relevant_def> {
     }
 }
 
-class ir_maps {
+struct ir_maps {
     let tcx: ty::ctxt;
     let method_map: typeck::method_map;
     let last_use_map: last_use_map;
@@ -505,7 +505,7 @@ fn invalid_users() -> users {
 const ACC_WRITE: uint = 2u;
 const ACC_USE: uint = 4u;
 
-class liveness {
+struct liveness {
     let tcx: ty::ctxt;
     let ir: @ir_maps;
     let s: specials;
index 70bf3f580ce02429bc7de671d7d44a253d067779..7ff5d96c9934d051eaf70c9aa1c49444f2b34fd3 100644 (file)
@@ -249,7 +249,7 @@ fn Atom(n: uint) -> Atom {
     return n;
 }
 
-class AtomTable {
+struct AtomTable {
     let atoms: hashmap<@~str,Atom>;
     let strings: DVec<@~str>;
     let mut atom_count: uint;
@@ -312,7 +312,7 @@ fn atom_hashmap<V:copy>() -> hashmap<Atom,V> {
 }
 
 /// One local scope.
-class Rib {
+struct Rib {
     let bindings: hashmap<Atom,def_like>;
     let kind: RibKind;
 
@@ -323,7 +323,7 @@ fn atom_hashmap<V:copy>() -> hashmap<Atom,V> {
 }
 
 /// One import directive.
-class ImportDirective {
+struct ImportDirective {
     let module_path: @DVec<Atom>;
     let subclass: @ImportDirectiveSubclass;
     let span: span;
@@ -339,7 +339,7 @@ fn atom_hashmap<V:copy>() -> hashmap<Atom,V> {
 }
 
 /// The item that an import resolves to.
-class Target {
+struct Target {
     let target_module: @Module;
     let bindings: @NameBindings;
 
@@ -349,7 +349,7 @@ fn atom_hashmap<V:copy>() -> hashmap<Atom,V> {
     }
 }
 
-class ImportResolution {
+struct ImportResolution {
     let span: span;
 
     // The number of outstanding references to this name. When this reaches
@@ -402,7 +402,7 @@ enum ParentLink {
 }
 
 /// One node in the tree of modules.
-class Module {
+struct Module {
     let parent_link: ParentLink;
     let mut def_id: option<def_id>;
 
@@ -491,7 +491,7 @@ fn unused_import_lint_level(session: session) -> level {
 
 // Records the definitions (at most one for each namespace) that a name is
 // bound to.
-class NameBindings {
+struct NameBindings {
     let mut module_def: ModuleDef;      //< Meaning in the module namespace.
     let mut type_def: option<def>;      //< Meaning in the type namespace.
     let mut value_def: option<def>;     //< Meaning in the value namespace.
@@ -611,7 +611,7 @@ fn span_for_namespace(namespace: Namespace) -> option<span> {
 }
 
 /// Interns the names of the primitive types.
-class PrimitiveTypeTable {
+struct PrimitiveTypeTable {
     let primitive_types: hashmap<Atom,prim_ty>;
 
     new(atom_table: @AtomTable) {
@@ -652,7 +652,7 @@ fn namespace_to_str(ns: Namespace) -> ~str {
 }
 
 /// The main resolver class.
-class Resolver {
+struct Resolver {
     let session: session;
     let lang_items: LanguageItems;
     let crate: @crate;
index 3195768a1052f0f8459a8d37e59a87ebe732c97e..d1452fa49063fa0c995dafaad619980302d786bd 100644 (file)
@@ -83,7 +83,7 @@ fn dup_for_join(dest: dest) -> dest {
     }
 }
 
-class icx_popper {
+struct icx_popper {
     let ccx: @crate_ctxt;
     new(ccx: @crate_ctxt) { self.ccx = ccx; }
     drop {
index 363f725b5fc6da345305604f2e8b3195c00a16e5..8e10be8e211cb202d4cfdab3b474bfe3a7c11195 100644 (file)
@@ -72,7 +72,7 @@ fn new_namegen() -> namegen {
      llvm_insns: hashmap<~str, uint>,
      fn_times: @mut ~[{ident: ~str, time: int}]};
 
-class BuilderRef_res {
+struct BuilderRef_res {
     let B: BuilderRef;
     new(B: BuilderRef) { self.B = B; }
     drop { llvm::LLVMDisposeBuilder(self.B); }
@@ -390,7 +390,7 @@ fn info() -> option<node_info> {
 // code.  Each basic block we generate is attached to a function, typically
 // with many basic blocks per function.  All the basic blocks attached to a
 // function are organized as a directed graph.
-class block_ {
+struct block_ {
     // The BasicBlockRef returned from a call to
     // llvm::LLVMAppendBasicBlock(llfn, name), which adds a basic
     // block to the function pointed to by llfn.  We insert
index 34c6e306ccc77faa2f7e69cff4e63e30f3670292..4e47b7524499d198d82089b9d5d506e2343fd246 100644 (file)
@@ -56,7 +56,7 @@ fn transform_self_type_for_method
     }
 }
 
-class lookup {
+struct lookup {
     let fcx: @fn_ctxt;
     let expr: @ast::expr;
     let self_expr: @ast::expr;
index c8a9f850aa05de8ed1208fd7df913c3acf0406ed..bfc2365f1a9a5d63859f8cb50ab41ec0679a7caa 100644 (file)
@@ -118,7 +118,7 @@ fn method_to_MethodInfo(ast_method: @method) -> @MethodInfo {
     }
 }
 
-class CoherenceInfo {
+struct CoherenceInfo {
     // Contains implementations of methods that are inherent to a type.
     // Methods in these implementations don't need to be exported.
     let inherent_methods: hashmap<def_id,@DVec<@Impl>>;
@@ -133,7 +133,7 @@ fn method_to_MethodInfo(ast_method: @method) -> @MethodInfo {
     }
 }
 
-class CoherenceChecker {
+struct CoherenceChecker {
     let crate_context: @crate_ctxt;
     let inference_context: infer_ctxt;
 
index b4195d0c04c013b285f728daa9c24cdd140d5263..e34113432aece8840e388bae69ce45e33f7f9319 100644 (file)
@@ -14,7 +14,7 @@ fn indent<R>(op: fn() -> R) -> R {
     return r;
 }
 
-class _indenter {
+struct _indenter {
     let _i: ();
     new(_i: ()) { self._i = (); }
     drop { debug!{"<<"}; }
index 9fb37977231912573626de34701622db274bea0b..8968d481f6a09dfb4eb34849e6e005f276fe6908 100644 (file)
@@ -111,7 +111,7 @@ mod blade_runner {
  * eget ante feugiat tortor congue auctor ac quis ante. Proin
  * condimentum lacinia tincidunt.
  */
-class bored {
+struct bored {
   let bored: bool;
   new(bored: bool) { self.bored = bored; }
   drop { log(error, self.bored); }
index 182bfd351d481910544e545bbea1f6c73c43c5c7..46312dc989bdeb6b961779b26eca84010d27cf62 100644 (file)
@@ -1,6 +1,6 @@
 mod kitties {
 
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index 92ffb217f6af2afcfff13e9df0c487adc8d20562..bd3e17000b1d94dc60e6f81252f51b1ad387f9f8 100644 (file)
@@ -1,6 +1,6 @@
 mod kitties {
 
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index dab856377f8f38831c06a14fe2d7ff49a7184b02..6b62cd166dbe01b5c8f351b2bf2389f2aea2dacb 100644 (file)
@@ -1,6 +1,6 @@
 mod kitties {
 
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index be2c982799b9cbde71a0c5ef714d56eb853b4ff6..56debd8574846255ae216ad023c3f356eb42e31f 100644 (file)
@@ -1,6 +1,6 @@
 mod kitties {
 
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
     fn meow() {
index 9a3f0a0ad362f7c4424ca0239dacadf605630069..5e5c5c53d9c3f11a6e3445cb43c09f70eee2a5f7 100644 (file)
@@ -1,6 +1,6 @@
 mod kitties {
 
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
       fn nap() { for uint::range(1u, 10000u) |_i|{}}
index ed52788440f90684b4799b1c126a46360c82c991..18ffb35d3e5e52590ea3b4e7f5096d3bef0c4611 100644 (file)
@@ -1,6 +1,6 @@
 mod kitties {
 
-class cat<U> {
+struct cat<U> {
   priv {
     let mut info : ~[U];
     let mut meows : uint;
index 64644f665d24980f5ce23c94242a5bd047eb8c10..fad0197564ca7c984821551ea9defc1854b3eba6 100644 (file)
@@ -3,7 +3,7 @@
 
 mod kitty {
 
-class cat : ToStr {
+struct cat : ToStr {
   priv {
     let mut meows : uint;
     fn meow() {
index f8b374dcf85d97233be90376fee4f6e2c34bd827..1d1adbf179d550559d69263199e34925cdb257c3 100644 (file)
@@ -7,7 +7,7 @@
 
 export context;
 
-class arc_destruct<T:const> {
+struct arc_destruct<T:const> {
   let _data: int;
   new(data: int) { self._data = data; }
   drop {}
@@ -21,7 +21,7 @@ fn init() -> arc_destruct<context_res> unsafe {
     arc(context_res())
 }
 
-class context_res {
+struct context_res {
     let ctx : int;
 
     new() { self.ctx = 0; }
index 3ee2a4d3f8334e541dd65bfd8a2c662adc6a6bda..d47f16c7f11002413800a8f9dfd415ac853cfb8e 100644 (file)
@@ -5,7 +5,7 @@ mod socket {
 
 export socket_handle;
 
-class socket_handle {
+struct socket_handle {
     let sockfd: libc::c_int;
     new(x: libc::c_int) {self.sockfd = x;}
     drop { /* c::close(self.sockfd); */ }
index 915adafab6634b25c93538de2cb4b71551139fcd..cca092faf002fae841636ff4df51fa90fb9dc8bc 100644 (file)
@@ -3,7 +3,7 @@
 fn foo(_x: i32) {
 }
 
-class rsrc {
+struct rsrc {
   let x: i32;
   new(x: i32) { self.x = x; }
   drop { foo(self.x); }
index 007ef3bcc43983b9bfa8c623e81847b1d9b9c591..dbc59ec0071c1fdb0ec2f3fb9d3df8d1ae981ca8 100644 (file)
@@ -27,7 +27,7 @@ fn port<T: send>() -> port<T> {
     port_t(@port_ptr(rustrt::new_port(sys::size_of::<T>() as size_t)))
 }
 
-class port_ptr<T:send> {
+struct port_ptr<T:send> {
    let po: *rust_port;
    new(po: *rust_port) {
     debug!{"in the port_ptr constructor"};
index eac1f67dcaa1b5c8e7f430ac2ac79ec2ef518c4c..3c2dfec2d7f93c2edc8428438ba73de2a60c20af 100644 (file)
@@ -40,7 +40,7 @@ enum st {
     })
 }
 
-class r {
+struct r {
   let _l: @nillist;
   new(l: @nillist) { self._l = l; }
   drop {}
index 7e8084adb7de9031207ea64828865e230dfc239d..2c45896acd9fb509e3dd17c4d5e75ed6b9c5ad28 100644 (file)
@@ -104,7 +104,7 @@ fn reduce(&&word: ~str, get: map_reduce::getter<int>) {
     io::println(fmt!{"%s\t%?", word, count});
 }
 
-class box<T> {
+struct box<T> {
     let mut contents: option<T>;
     new(+x: T) { self.contents = some(x); }
 
@@ -350,7 +350,7 @@ fn is_word_char(c: char) -> bool {
     char::is_alphabetic(c) || char::is_digit(c) || c == '_'
 }
 
-class random_word_reader: word_reader {
+struct random_word_reader: word_reader {
     let mut remaining: uint;
     let rng: rand::Rng;
     new(count: uint) {
index bd1a17c6b82a47590f9c11ddf4229a0ecae70870..42781866f9a1c8444d40a48b5cafb43502b90006 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index ec42d83085ba904350b924e52c0b768c720d062a..958cabb61b84953031d2a1bcb8feff58dc77db9d 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern:mismatched types: expected `()` but found `bool`
 
-class r {
+struct r {
   new() {}
   drop { true }
 }
index 53bb3a6d0653ae165efc78e8bb113a8131498a51..82c09f5036b34e7f0968fd143db584e88cacc67d 100644 (file)
@@ -1,4 +1,4 @@
-class noncopyable {
+struct noncopyable {
     i: (); new() { self.i = (); } drop { #error["dropped"]; }
 }
 enum wrapper = noncopyable;
index f7863013898fc990bb3125a373a446027cfbac9b..3703c44f520d51e868d27898db22db948674b95a 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern: copying a noncopyable value
 
-class foo { let x: int; new(x: int) { self.x = x; } drop { } }
+struct foo { let x: int; new(x: int) { self.x = x; } drop { } }
 
 fn to_lambda2(b: foo) -> fn@(uint) -> uint {
     // test case where copy clause specifies a value that is not used
index eba939d76e7ebe8df59222b5c368737fc509c172..ac4741a0e68443b91036c19b1f102a59b90f4ae8 100644 (file)
@@ -3,7 +3,7 @@ trait noisy {
   fn speak();
 }
 
-class cat : noisy {
+struct cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index ccc821ce78a2e497a0360cb8921d9e61f1e124d2..9f86953c3cf92399d0f3599cbfd6c3877407f689 100644 (file)
@@ -1,4 +1,4 @@
-class cat : int { //~ ERROR trait
+struct cat : int { //~ ERROR trait
   let meows: uint;
   new(in_x : uint) { self.meows = in_x; }
 }
index b49fa62577d75fc25aa8910158e4280a3e41042e..31cc23d8162e114441861a9596ea9ac4f8e5de77 100644 (file)
@@ -3,7 +3,7 @@ trait animal {
   fn eat();
 }
 
-class cat : animal {
+struct cat : animal {
   let meows: uint;
   new(in_x : uint) { self.meows = in_x; }
 }
index 4bad4bd2bc5ccaec2d6ec3a7033660df956cfce8..84cd137f23e51e9c507c678174d74bd4decf8271 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
     fn sleep() { loop{} }
index 6eeb4ea2ed440c3646b1894bd08d40e5f48fe9cd..2e8673156bf15eb06cef7561f1dfd894653b5207 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern: copying a noncopyable value
 
-class foo {
+struct foo {
   let i: int;
   new(i:int) { self.i = i; }
   drop {}
index 9f489101f1bdebf659303931663a4c119ab2e750..98eb509c8d77432329c670ed8b8d0331ee7a9712 100644 (file)
@@ -1,7 +1,7 @@
 // test that autoderef of a type like this does not
 // cause compiler to loop.  Note that no instances
 // of such a type could ever be constructed.
-class t { //~ ERROR this type cannot be instantiated
+struct t { //~ ERROR this type cannot be instantiated
   let x: x;
   let to_str: ();
   new(x: x) { self.x = x; self.to_str = (); }
index fbd13ca61678bc8ed6393b4a73bab171cf8e4055..e8abfd3f450e8c5cd192fe65c01e80d3ff19df1d 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern: type cat cannot be dereferenced
-class cat { new() {} }
+struct cat { new() {} }
 
 fn main() {
   let kitty : cat = cat();
index 4cfd5efef2205e16eafdb7fdc06bea7811ad4044..9074eb7e1b8053bf27ac416dec94bc691028afde 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern: type cat cannot be dereferenced
-class cat { new() {} }
+struct cat { new() {} }
 
 fn main() {
   let nyan = cat();
index a18b886c6c78fd8485db7aa4a1b6e99882b197bb..ada5b6ffa05d583f74927c81dc158e24a08cc62a 100644 (file)
@@ -1,4 +1,4 @@
-class socket {
+struct socket {
     let sock: int;
 
     new() { self.sock = 1; }
index 3783400d78b36f422d05b64229bf475223065d0e..fc1f4dc7159feef3c74fd7087a9288cf33c99581 100644 (file)
@@ -1,4 +1,4 @@
-class c { //~ ERROR a struct must have at least one field
+struct c { //~ ERROR a struct must have at least one field
     new() { }
 }
 
index b068f9e1dc25a2dba676ebd45c23b89208f6abdf..d7ea3f67d417c6b864b9c65386aed5c34782f219 100644 (file)
@@ -1,4 +1,4 @@
-class send_packet<T: copy> {
+struct send_packet<T: copy> {
   let p: T;
   new(p: T) { self.p = p; }
 }
index 7b4a1bf3dba766ae1dafa4fd3ee20e4a097d4106..7be3d077050ac8ae863447daf768620d9cd0a9e2 100644 (file)
@@ -1,4 +1,4 @@
-class example {
+struct example {
     let x: int;
     new() {
         self.x = 1;
index 847b7bccdb64f5708612be297a1665d5768ffbdb..82a76273bd473881bc479f66a56723d866737554 100644 (file)
@@ -1,4 +1,4 @@
-class example {
+struct example {
   let x: int;
   new() { //~ ERROR First constructor declared here
     self.x = 1;
index 1e40ba92501511844e786ed0f140ebbc59efb486..005cae43081b3e722a48682b83958e11eabf1e25 100644 (file)
@@ -2,7 +2,7 @@
 
 fn siphash(k0 : u64) {
 
-    class siphash {
+    struct siphash {
         let mut v0: u64;
         fn reset() {
            self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR attempted dynamic environment-capture
index 701e3f8f4a0f8d3decd0af632c0fc125f2b4166c..94043961484e761c3c888bab4d8262a40aef3924 100644 (file)
@@ -1,5 +1,5 @@
 #[forbid(non_camel_case_types)]
-class foo { //~ ERROR type, variant, or trait must be camel case
+struct foo { //~ ERROR type, variant, or trait must be camel case
     let bar: int;
 
     new() {
index 0480bc71798a7b8da22b69f0ead93f8cb1a6dae6..a3277db4fcec473e05169543f1e5183e85df2437 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   let how_hungry : int;
   fn meow() {}
   new() {
index d71dff980642217187ef341463d241c3a25f3873..405c1a4b57b98cbe533d1aff921ec7d7911b5b1b 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   let how_hungry : int;
   new() {} //~ ERROR field `self.how_hungry` is never initialized
 }
index 3d4a88db26222caf6d2c402a12a38d6f4eb80974..9a846efae4e2b4f3d37e85511d8c07e294083bb6 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   let mut a: int;
   let mut b: int;
   let mut c: int;
index d03c7888974e11d1a225ebc566c070bbf6a02b0d..041812a575f3a2dbbd720c2eee16a0e831e4ddc2 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index c1d4cdb4a57d5a885b6fc3bdcc0c264a2d876cd5..f778a8da323293b01824624ec17a4e44b529137d 100644 (file)
@@ -35,7 +35,7 @@ fn f4() {
 }
 
 // leave this in here just to trigger compile-fail:
-class r {
+struct r {
     let x: ();
     new() { self.x = (); }
     drop {}
index d00d5dda230b7e7ade01d4e274b1943a9989d65b..808b7ff31772562a0403e36389e31c8c792c11cc 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern:assigning to immutable field
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index 6ee8c5ead7ed5e7c97da2e175ebf5a0ff07066fb..011656ac3ad9a06b4f8e6ed9fba6aed898cf0c79 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern:assigning to immutable field
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index a62278cefe1487167d2400adda082f8ac91fb564..1fa823938caa5ad7bc09c60a8cfdce965bddd74a 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
-    class foo {
+    struct foo {
       let _x: comm::Port<()>;
       new(x: comm::Port<()>) { self._x = x; }
       drop {}
index 29f6e1f7be28bc8055bd998e39e6872a94efda2a..cd160294f748291db0c93d7c9562ea6a77938b8c 100644 (file)
@@ -2,13 +2,13 @@
 
 fn foo<T: const>(_x: T) { }
 
-class r {
+struct r {
   let x:int;
   new(x:int) { self.x = x; }
   drop {}
 }
 
-class r2 {
+struct r2 {
   let x:@mut int;
   new(x:@mut int) { self.x = x; }
   drop {}
index 736fee0f66cb9e2ef575fe09974b9e0706f787de..e1fd1294b14ab69c665eb4b76f5725c484abd483 100644 (file)
@@ -2,13 +2,13 @@
 
 // Test that a class with a non-copyable field can't be
 // copied
-class bar {
+struct bar {
   let x: int;
   new(x:int) {self.x = x;}
   drop {}
 }
 
-class foo {
+struct foo {
   let i: int;
   let j: bar;
   new(i:int) { self.i = i; self.j = bar(5); }
index 496a4fcbe76ebac745ba008c9df51869bcd13a22..ce9dfbc3f623f14cf751753612b5589e215f4156 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern: copying a noncopyable value
 
-class r {
+struct r {
   let i: @mut int;
   new(i: @mut int) { self.i = i; }
   drop { *(self.i) = *(self.i) + 1; }
index 15aba5d009d070c7becd0d4535cad0c4b51935a2..ae0ae7c4a574236a6d9cbf98c3e002adadf21e6b 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern:no public field or method with that name
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index f59e583f9b9a0077db8c0e88604a1e4d345911dc..a1d71ba6af91cb9021a39c57a630a6d3451faed3 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern:call to private method not allowed
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
       fn nap() { uint::range(1u, 10000u, |_i|{})}
index 69f0cf09726e71180704fcebbb70f0298e698add..3540f03e800bb44d20293ede1872b94274de9d37 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern: copying a noncopyable value
 
-class my_resource {
+struct my_resource {
   let x: int;
   new(x: int) { self.x = x; }
   drop { log(error, self.x); }
index 2aa84a273ec9a188858bb80158367d5ee2a4e303..ea1181cd94a8d42fa37c5955cc3e4d0480ab6961 100644 (file)
@@ -1,4 +1,4 @@
-class dog {
+struct dog {
     let mut cats_chased: uint;
 
     new() {
index e44674919bed7c4a19862642b92125a386d611bf..31d2fef14ebd29aa17b2fe01e2b6743ce90c787d 100644 (file)
@@ -1,4 +1,4 @@
-class dog {
+struct dog {
     let mut food: uint;
 
     new() {
index 28c3b1c4463ed1a524987553ba802bc10109179d..a4faeed69589453fb501cd20451b5160eada5d31 100644 (file)
@@ -4,7 +4,7 @@
 
 enum an_enum = &int;
 trait a_trait { fn foo() -> &self/int; }
-class a_class { let x:&self/int; new(x:&self/int) { self.x = x; } }
+struct a_class { let x:&self/int; new(x:&self/int) { self.x = x; } }
 
 fn a_fn1(e: an_enum/&a) -> an_enum/&b {
     return e; //~ ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a`
index 61ed8d3b6f3f0fc999ec7ffb7f81a40c85d5b8b9..e02683b737204b82a3120fd5b15cddbd7139c444 100644 (file)
@@ -1,16 +1,16 @@
-class yes0 {
+struct yes0 {
   let x: &uint;
   new(x: &uint) { self.x = x; }
   drop {}
 }
 
-class yes1 {
+struct yes1 {
   let x: &self/uint;
   new(x: &self/uint) { self.x = x; }
   drop {}
 }
 
-class yes2 {
+struct yes2 {
   let x: &foo/uint; //~ ERROR named regions other than `self` are not allowed as part of a type declaration
   new(x: &foo/uint) { self.x = x; } //~ ERROR named regions other than `self` are not allowed as part of a type declaration
   drop {}
index a3ecbec5b11246e43da41e550def822b12eca7f9..641e0351a471cc9cd075727441a649cd2383e2bf 100644 (file)
@@ -1,4 +1,4 @@
-class box_impl<T> {
+struct box_impl<T> {
     let mut f: T;
 
     new(f: T) {
index 75250d9faf6c13eb36911259366dd33698dc4092..d729aad5f02b500e5b123c49294ad16db8c2296c 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern: copying a noncopyable value
 
-class r {
+struct r {
   let b:bool;
   new(b: bool) { self.b = b; }
   drop {}
index a58ae84459d37984c82567d70da8fea28307fb50..e357bf28373d4dcb4a68086a956532e5ce59db33 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern: copying a noncopyable value
 
-class r {
+struct r {
   let i: @mut int;
   new(i: @mut int) { self.i = i; }
   drop { *(self.i) = *(self.i) + 1; }
index bd291b3fdedcef678d66cf9dc8d87569f2e85145..7a724ff3d5c2eada913d84e9c4b9a4b16f5e4c9a 100644 (file)
@@ -1,7 +1,7 @@
 // Test that a class with an unsendable field can't be
 // sent
 
-class foo {
+struct foo {
   let i: int;
   let j: @~str;
   new(i:int, j: @~str) { self.i = i; self.j = j; }
index f622665d082a7b27b12647ec30f143c275bb1736..7fbcc67da17d7a21d5b0e70909c0c4345d44f5c8 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern: copying a noncopyable value
 
-class r {
+struct r {
   let i:int;
   new(i:int) {self.i = i;}
   drop {}
index 649d00dc1f4d9cf73681f993dc27e28193910938..3edc22252b253adc3b41c31b39c3f3f18a82b4c7 100644 (file)
@@ -20,7 +20,7 @@ fn getbig_call_c_and_fail(i: int) {
     }
 }
 
-class and_then_get_big_again {
+struct and_then_get_big_again {
   let x:int;
   new(x:int) {self.x = x;}
   drop {
index 962026bfc4742ce45b4f6cba2e442a5e4a88371d..fd537df50eb78d1763e1c06d944668eb758e4050 100644 (file)
@@ -13,7 +13,7 @@ fn getbig_and_fail(&&i: int) {
     }
 }
 
-class and_then_get_big_again {
+struct and_then_get_big_again {
   let x:int;
   new(x:int) {self.x = x;}
   drop {
index dffad4fc6ab73669403c0312a6878ab1b10f767a..9977e4616d8c8f5701bca523cf64f2ae4c6dd9a7 100644 (file)
@@ -13,7 +13,7 @@ fn getbig_and_fail(&&i: int) {
     }
 }
 
-class and_then_get_big_again {
+struct and_then_get_big_again {
   let x:int;
   new(x:int) {self.x = x;}
   drop {}
index 1cd6784cf42c03e94fd8974bab6e66f120182f38..6a722ecdedfc8e96ec382f416b8407cd58fa3efa 100644 (file)
@@ -1,6 +1,6 @@
 // error-pattern:whatever
 
-class r {
+struct r {
   let x:int;
             // Setting the exit status after the runtime has already
             // failed has no effect and the process exits with the
index 8b771dc7651a35b1b0a8855f2594eae70d33bfda..90850e44867a8c216ad0a187cea5f3f9de31dab1 100644 (file)
@@ -4,7 +4,7 @@ fn failfn() {
     fail;
 }
 
-class r {
+struct r {
   let v: *int;
   new(v: *int) { self.v = v; }
   drop unsafe {
index d8909290ae49cdb23c5a274fe43165a507373a60..9697084fe5cc623012a86be56390b6ade10e75f5 100644 (file)
@@ -125,7 +125,7 @@ fn test_foreign_fn() {
     assert test::rust_get_sched_id == test::rust_get_sched_id;
 }
 
-class p {
+struct p {
   let mut x: int;
   let mut y: int;
   new(x: int, y: int) { self.x = x; self.y = y; }
index e41eb1325252b8e957904062aad307c04063fd73..9bd86183cba694e528b7220a82a323799397db3c 100644 (file)
@@ -7,7 +7,7 @@
 
 fn empty<T>() -> Tree<T> { fail }
 
-class Box {
+struct Box {
     let tree: Tree<@Box>;
 
     new() {
index d08ef04eca62a0f5c3a2ef53ac5e8164248da73f..ff1b85125ea30ff8dd398b09dabd8e6356c52715 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   let name: ~str;
   #[cat_maker]
   /**
index d28c60dd291e1f6800a50e0b9636b257a1ac110c..735426abf2c0867d3a4c14dd208d5299be2b704b 100644 (file)
@@ -2,7 +2,7 @@ trait noisy {
   fn speak() -> int;
 }
 
-class dog : noisy {
+struct dog : noisy {
   priv {
     let barks : @mut uint;
     fn bark() -> int {
@@ -26,7 +26,7 @@ fn bark() -> int {
   fn speak() -> int { self.bark() }
 }
 
-class cat : noisy {
+struct cat : noisy {
   priv {
     let meows : @mut uint;
     fn meow() -> uint {
index 42e0c9b337bfae593375a55e6e2fbc7f781b56b4..8f5318f2bf15818e9957e1a32332cb16a8d66bcc 100644 (file)
@@ -2,7 +2,7 @@ trait noisy {
   fn speak();
 }
 
-class cat : noisy {
+struct cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index f7d113cdbfc69e2afd4b61e80b138e33c5c784ee..9c22f23aceab698e2eccadc7c78079d5cd9d32a9 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   let done : extern fn(uint);
   let meows : uint;
   new(done: extern fn(uint)) {
index b9f99f2076d77f695d7f30c9c045e1212d54989f..d5a2c4da1da7e77e28a8c13b440a413da4fa81e8 100644 (file)
@@ -5,7 +5,7 @@
 
 mod kitty {
   export cat;
-  class cat {
+  struct cat {
     let meows: uint;
     let name: ~str;
 
index b77f645d13bc604ac449852123740b83eea26e0c..43c3315577f20a30fff9b3435404a5a1cc2f5a83 100644 (file)
@@ -7,7 +7,7 @@ enum cat_type { tuxedo, tabby, tortoiseshell }
 // for any int value that's less than the meows field
 
 // ok: T should be in scope when resolving the trait ref for map
-class cat<T: copy> : map<int, T> {
+struct cat<T: copy> : map<int, T> {
   priv {
     // Yes, you can have negative meows
     let mut meows : int;
index 7a99558a3c377b7d9c9d1d2c251c74fd663d9068..2a4c112a3ac945f1646d933dfe03d7395e919170 100644 (file)
@@ -3,7 +3,7 @@
 use cci_class_trait;
 import cci_class_trait::animals::*;
 
-class cat : noisy {
+struct cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index 17e0a9902ab55588e98f42d2fc57316eaf7b28e5..f6cc934eb86cd9be805ae63132b88ab610ca0e41 100644 (file)
@@ -2,7 +2,7 @@ trait noisy {
   fn speak();
 }
 
-class cat : noisy {
+struct cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index 8023879ca9711ed73755e046133578ab30e56215..825f9caf395136381e251163c46d2ab1637e6702 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index 5808b0789d16bc0a626214f4059aa963117a96f4..8eb9c19a963e6bbd18867acd734b62d19701b769 100644 (file)
@@ -1,4 +1,4 @@
-class cat<U> {
+struct cat<U> {
   priv {
     let mut info : ~[U];
     let mut meows : uint;
index 097418cd884ce1eb5c0b0fc6ba069aa8ae4dada3..af4a37d3c8d9725e1fa786a52df623c06fdf44da 100644 (file)
@@ -2,7 +2,7 @@
 import to_str::*;
 import to_str::ToStr;
 
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
     fn meow() {
index e0f7441db856a2988fa7441a92f5d34b5e91dbca..97ffdea1e59dc56a9f76ee9a04d1622529c45a0a 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
 
   let name : ~str;
 
index caefb72a6a47d7322a515deea04b8075eed6aab6..834988eaf97572b17f66f88137a08a4490cdf073 100644 (file)
@@ -1,4 +1,4 @@
-class cat<U> {
+struct cat<U> {
   priv {
     let mut meows : uint;
   }
index 7add8fec1b1ee82d73a2f3b765c3c30aa55558e7..bc55737487816a2a78ea995308c395edb079ee83 100644 (file)
@@ -1,4 +1,4 @@
-class kitten {
+struct kitten {
     let cat: option<cat>;
     new(cat: option<cat>) {
        self.cat = cat;
index 8fcf5b96be2d82f113b9f985c61f9e29cc4a177d..388ea5f8776f482cca8174b11f031fd70191eff7 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index ae37fb9a9979841cc581f3ac6c2ce863c403e1e9..ef93e0e3bc6690a1ef6ed9329118140a53fd7b45 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index dbd590fb08f422a0860f41f7fcf0066a1b959078..624c850f6a8e1c7f0640b928edc3a8766aefd5d2 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
     fn meow() {
index da18e9fabfb191c64abf12e1f68b64943be0792a..4066b054a8aea0b226d57b87daec4126e2433bde 100644 (file)
@@ -25,12 +25,12 @@ enum tg { foo, }
 enum tg { bar, }
 
 #[cfg(bogus)]
-class r {
+struct r {
   let i: int;
   new(i:int) { self.i = i; }
 }
 
-class r {
+struct r {
   let i: int;
   new(i:int) { self.i = i; }
 }
index 0cfdc7118e68075869debb111d09cfa7213a7ed4..2609080ebc9148f5514ac780567434b15f012ce0 100644 (file)
@@ -1,7 +1,7 @@
 // Resources can't be copied, but storing into data structures counts
 // as a move unless the stored thing is used afterwards.
 
-class r {
+struct r {
   let i: @mut int;
   new(i: @mut int) {
     self.i = i;
index 559edf37956de591aadef067ba0278587eea48bb..52d71e6adcb12d39693dfded524ef5c3a968bdf4 100644 (file)
@@ -1,7 +1,7 @@
 trait clam<A: copy> {
   fn chowder(y: A);
 }
-class foo<A: copy> : clam<A> {
+struct foo<A: copy> : clam<A> {
   let x: A;
   new(b: A) { self.x = b; }
   fn chowder(y: A) {
index 328b6b3b4c3f2fd139d9c4cf82c5a852faac2540..4c8e99ab46f13f56c5e13458ac4722efb591efa8 100644 (file)
@@ -1,5 +1,5 @@
 trait clam<A: copy> { }
-class foo<A: copy> {
+struct foo<A: copy> {
   let x: A;
   new(b: A) { self.x = b; }
    fn bar<B,C:clam<A>>(c: C) -> B {
index b004eba99c4443085b956dc302a6915180ce9089..b2f149254811cdc7ede2ee610b75b31afb3efd3d 100644 (file)
@@ -1,4 +1,4 @@
-class c1<T: copy> {
+struct c1<T: copy> {
   let x: T;
   new(x: T) {self.x = x;}
 
index 461dbfadbac1f6b3aef06fa65776c5160ef1387d..5dea6ff2269f9512f7a7d8e6cd1be8dcdd3cb1a6 100644 (file)
@@ -1,6 +1,6 @@
 import dvec::dvec;
 
-class c1<T: copy> {
+struct c1<T: copy> {
   let x: T;
   new(x: T) {self.x = x;}
 
index 2cd17923bf006d5a37ab3ce10f56712411c103a7..0cff6b57c2acc08e38768b9bc74aba8fb60a4266 100644 (file)
@@ -1,4 +1,4 @@
-class socket {
+struct socket {
     let sock: int;
 
     new() { self.sock = 1; }
index 557bfd1383de3188891ebb0b42734f27a94971ae..b554fef4564daba632f3350767445a05ed62fd8c 100644 (file)
@@ -1,4 +1,4 @@
-class font {
+struct font {
     let fontbuf: &self/~[u8];
 
     new(fontbuf: &self/~[u8]) {
index 6e8a43dc2cf1ed933fb08d769a8b8dad750015ab..70af9ca03dc2ef30e68571409eccaa4ebfaf4289 100644 (file)
@@ -1,4 +1,4 @@
-class C {
+struct C {
     let x: uint;
 
     new(x: uint) {
index d08a863529c79721e1cfe59edb8fdf1b59a4c11e..0c49fc577452e47656b823d70c21899e9805d7fc 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
     let mut meow: fn@();
     new() { self.meow = fn@() { error!{"meow"}; };}
 }
index 8fcc613b09b7306a30c1b0bce77295be7da67bce..18d9338739c7ca4697cb876235af4919aa90b10f 100644 (file)
@@ -1,4 +1,4 @@
-class Font {
+struct Font {
     let fontbuf: uint;
     let cairo_font: uint;
     let font_dtor: uint;
index a55024097a083f5d3dd2776311a1113bb6769ae6..cc3e18bff84011d76b65cc98dbf92d4d1ee1796a 100644 (file)
@@ -133,7 +133,7 @@ fn receiver_terminate<T: send>(p: *packet<T>) {
         }
     }
 
-    class send_packet<T: send> {
+    struct send_packet<T: send> {
         let mut p: option<*packet<T>>;
         new(p: *packet<T>) { self.p = some(p); }
         drop {
@@ -150,7 +150,7 @@ fn unwrap() -> *packet<T> {
         }
     }
 
-    class recv_packet<T: send> {
+    struct recv_packet<T: send> {
         let mut p: option<*packet<T>>;
         new(p: *packet<T>) { self.p = some(p); }
         drop {
index aa9537c7259cf8108b607c716e4dade05f735b97..eaec723de297bb5ae5c39cceda23d0aa8f0bb8dc 100644 (file)
@@ -1,5 +1,5 @@
 // This test should behave exactly like issue-2735-3
-class defer {
+struct defer {
     let b: &mut bool;
     new(b: &mut bool) {
         self.b = b;
index 876158d08b24d806f2b471e713efc92113cf6e73..b41b65cf6df39424ad7f5504a4a2b793c2b57566 100644 (file)
@@ -1,5 +1,5 @@
 // This test should behave exactly like issue-2735-2
-class defer {
+struct defer {
     let b: &mut bool;
     new(b: &mut bool) {
         self.b = b;
index 2d8dd45b0431f48b89e6fc6c8d6b40b2fae41bf0..fb7e10a2b17ea97637ade460a2e19ddd5e78edb7 100644 (file)
@@ -1,4 +1,4 @@
-class CMap {
+struct CMap {
     let buf: &[u8];
 
     new(buf: &self/[u8]) {
index ef1c46eb60543f88031eaffe86abe922da008e06..9c2f4940fa567bbf1a3fd39d6af884a4e9d79de7 100644 (file)
@@ -1,4 +1,4 @@
-class r {
+struct r {
   let b: @mut int;
   new(b: @mut int) {
     self.b = b;
index 619f3711a2e7ac1d89ab6f6508c8d926de344b1b..cfc3064b55227162a41d84db35a85296fa1e147d 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
   
-  class b {
+  struct b {
     let i: int;
     fn do_stuff() -> int { return 37; }
     new(i:int) { self.i = i; }
index a6baea1ffa7d376896c2db617bf63f6cc34b38ed..a988ad467373e3400f7c3025085a120463d68f2f 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
   }
index a6c1929dc1f0ad5d039c8853777e628034169a63..569359a9db134699d1afb35480e42817b6791fdd 100644 (file)
@@ -1,4 +1,4 @@
-class cat {
+struct cat {
   priv {
     let mut meows : uint;
       fn nap() { for uint::range(1u, 10u) |_i| { }}
index 80e3209dce3b36c4b1f060e26204eaf99a5b1ac1..08fc743af8022fee56b20f29783f76ccd92dbda5 100644 (file)
@@ -1,4 +1,4 @@
-class r {
+struct r {
   let i: @mut int;
   new(i: @mut int) {
     self.i = i;
index 2adcae2c5c3524ec4bdd2372f7a21f0ed03a8bd6..8e8ede16d8c22471213b678023d1bade089059c7 100644 (file)
@@ -1,6 +1,6 @@
 // Don't leak the unique pointers
 
-class r {
+struct r {
   let v: *int;
   new(v: *int) unsafe {
     self.v = v;
index 4f0f87908cffb06bc7f868e036fc28e4808f980f..69bed27f91373cbf2a2c2dbc91f1aee77c0938fc 100644 (file)
@@ -6,7 +6,7 @@
     c: *int
 };
 
-class r {
+struct r {
   let v: u;
   new(v: u) { self.v = v; }
   drop unsafe {
index f67e0b18ec2954c1a1360f615d5be79d66da03cb..f0b47024f409cbb48ff03bb3da120e975dcdd6e5 100644 (file)
@@ -8,7 +8,7 @@
     c: *int
 };
 
-class r {
+struct r {
   let v: u;
   let w: int;
   let x: *int;
index 4cd713c4e3a3a140869dac8531f36bd846f391ae..f6e32650b8ea58fb62054e6a64bdcaba2c5198c1 100644 (file)
@@ -1,4 +1,4 @@
-class shrinky_pointer {
+struct shrinky_pointer {
   let i: @@mut int;
   fn look_at() -> int { return **(self.i); }
   new(i: @@mut int) { self.i = i; }
index 21fe5461789c27ae8542d112269d4b15a8ec67a3..618848e1edd251e3b591d4a1d3f256b273849535 100644 (file)
@@ -1,4 +1,4 @@
-class finish<T: copy> {
+struct finish<T: copy> {
   let arg: {val: T, fin: extern fn(T)};
   new(arg: {val: T, fin: extern fn(T)}) {
     self.arg = arg;
index 8582bdeddfabb301673082a6fac6fcace10c2384..2fbe658fd6cc45e06cade6cc8b1fd62691818a72 100644 (file)
@@ -3,7 +3,7 @@
 
 type closable = @mut bool;
 
-class close_res {
+struct close_res {
   let i: closable;
  
   new(i: closable) { self.i = i; }
index 9008ccf726a6c4861242091aaefb4c0430c788e9..bb3957e2707c160e079c1e3e48813b42a5ac10d0 100644 (file)
@@ -1,7 +1,7 @@
 import task::*;
 import comm::*;
 
-class test {
+struct test {
   let f: int;
   new(f: int) { self.f = f; }
   drop {}
index b421f8cdf2ef14bc392060736130f29f0c403b47..9d26e3d26d8a277a90a98eb77c182e6820a93c5a 100644 (file)
@@ -1,6 +1,6 @@
 // Test that a class with only sendable fields can be sent
 
-class foo {
+struct foo {
   let i: int;
   let j: char;
   new(i:int, j: char) { self.i = i; self.j = j; }
index 4c061f152f4e288d78f0e03088ec23912db4a76c..85f842a49a9618e5ff05152b5689b293c5a7ab8b 100644 (file)
@@ -6,7 +6,7 @@
 use std;
 import task;
 
-class notify {
+struct notify {
     let ch: comm::Chan<bool>; let v: @mut bool;
     new(ch: comm::Chan<bool>, v: @mut bool) { self.ch = ch; self.v = v; }
     drop {
index 84b6eb896538e52b6c3fc0187bdc554e2b663df4..e049c0ecf38af2dbf6730834b4ef2a5d67ec4f56 100644 (file)
@@ -2,7 +2,7 @@ fn p_foo<T>(pinned: T) { }
 fn s_foo<T: copy>(shared: T) { }
 fn u_foo<T: send>(unique: T) { }
 
-class r {
+struct r {
   let i: int;
   new(i:int) { self.i = i; }
   drop {}
index 1bde7b3e60eb50123b6d83c2601fcf206375f9b0..db550ca608e8fa3aa28215171774cf810b3c4906 100644 (file)
@@ -1,4 +1,4 @@
-class r {
+struct r {
   let i: @mut int;
   new(i: @mut int) { self.i = i; }
   drop { *(self.i) = *(self.i) + 1; }
index 39b619c590513ef43be6232c8903a2cae920cbe9..a358f0822253bccd2e9c9a1af2d614d48d01b825 100644 (file)
@@ -3,7 +3,7 @@
 import task;
 import comm;
 
-class complainer {
+struct complainer {
   let c: comm::Chan<bool>;
   new(c: comm::Chan<bool>) {
     error!{"Hello!"};
index 79847cafaf451338d9473dff88f7bf09b0ec545c..4b3ae5b76b2d0ddd47441ecf2bc6ffd6b2b966ed 100644 (file)
@@ -3,7 +3,7 @@
 import task;
 import comm;
 
-class complainer {
+struct complainer {
   let c: @int;
   new(c: @int) { self.c = c; }
   drop {}
index 2c5225fa0f9a279d8b8a64b39570c588d6c9e7c8..771fb94621116bead88af2dcc388ad62fd6c0794 100644 (file)
@@ -1,5 +1,5 @@
 // Make sure that destructors get run on slice literals
-class foo {
+struct foo {
     let x: @mut int;
     new(x: @mut int) { self.x = x; }
     drop { *self.x += 1; }