1
Fork 0

Remove 'let' syntax for struct fields

This commit is contained in:
Brian Anderson 2012-09-06 19:40:15 -07:00
parent 14303bad89
commit 2572e80355
129 changed files with 322 additions and 325 deletions

View file

@ -98,7 +98,7 @@ fn listen<T: send, U>(f: fn(Chan<T>) -> U) -> U {
} }
struct PortPtr<T:send> { struct PortPtr<T:send> {
let po: *rust_port; po: *rust_port,
drop unsafe { drop unsafe {
do task::unkillable { do task::unkillable {
// Once the port is detached it's guaranteed not to receive further // Once the port is detached it's guaranteed not to receive further
@ -138,7 +138,7 @@ fn PortPtr<T: send>(po: *rust_port) -> PortPtr<T> {
fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U { fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
struct PortRef { struct PortRef {
let p: *rust_port; p: *rust_port,
drop { drop {
if !ptr::is_null(self.p) { if !ptr::is_null(self.p) {
rustrt::rust_port_drop(self.p); rustrt::rust_port_drop(self.p);

View file

@ -36,9 +36,9 @@ export cleanup_stack_for_failure;
// Mirrors rust_stack.h stk_seg // Mirrors rust_stack.h stk_seg
struct StackSegment { struct StackSegment {
let prev: *StackSegment; prev: *StackSegment,
let next: *StackSegment; next: *StackSegment,
let end: uintptr_t; end: uintptr_t,
// And other fields which we don't care about... // And other fields which we don't care about...
} }

View file

@ -246,7 +246,7 @@ impl<T: Reader, C> {base: T, cleanup: C}: Reader {
} }
struct FILERes { struct FILERes {
let f: *libc::FILE; f: *libc::FILE,
drop { libc::fclose(self.f); } drop { libc::fclose(self.f); }
} }
@ -422,7 +422,7 @@ impl fd_t: Writer {
} }
struct FdRes { struct FdRes {
let fd: fd_t; fd: fd_t,
drop { libc::close(self.fd); } drop { libc::close(self.fd); }
} }
@ -778,7 +778,7 @@ mod fsync {
// Artifacts that need to fsync on destruction // Artifacts that need to fsync on destruction
struct Res<t> { struct Res<t> {
let arg: Arg<t>; arg: Arg<t>,
drop { drop {
match self.arg.opt_level { match self.arg.opt_level {
option::None => (), option::None => (),

View file

@ -292,7 +292,7 @@ fn test_unwrap_str() {
#[test] #[test]
fn test_unwrap_resource() { fn test_unwrap_resource() {
struct R { struct R {
let i: @mut int; i: @mut int,
drop { *(self.i) += 1; } drop { *(self.i) += 1; }
} }

View file

@ -134,7 +134,7 @@ impl State: Eq {
struct BufferHeader { struct BufferHeader {
// Tracks whether this buffer needs to be freed. We can probably // Tracks whether this buffer needs to be freed. We can probably
// get away with restricting it to 0 or 1, if we're careful. // get away with restricting it to 0 or 1, if we're careful.
let mut ref_count: int; mut ref_count: int,
// We may want a drop, and to be careful about stringing this // We may want a drop, and to be careful about stringing this
// thing along. // thing along.
@ -158,12 +158,12 @@ type Buffer<T: send> = {
}; };
struct PacketHeader { struct PacketHeader {
let mut state: State; mut state: State,
let mut blocked_task: *rust_task; mut blocked_task: *rust_task,
// This is a reinterpret_cast of a ~buffer, that can also be cast // This is a reinterpret_cast of a ~buffer, that can also be cast
// to a buffer_header if need be. // to a buffer_header if need be.
let mut buffer: *libc::c_void; mut buffer: *libc::c_void,
// Returns the old state. // Returns the old state.
unsafe fn mark_blocked(this: *rust_task) -> State { unsafe fn mark_blocked(this: *rust_task) -> State {
@ -374,7 +374,7 @@ unsafe fn get_buffer<T: send>(p: *PacketHeader) -> ~Buffer<T> {
// This could probably be done with SharedMutableState to avoid move_it!(). // This could probably be done with SharedMutableState to avoid move_it!().
struct BufferResource<T: send> { struct BufferResource<T: send> {
let buffer: ~Buffer<T>; buffer: ~Buffer<T>,
drop unsafe { drop unsafe {
let b = move_it!(self.buffer); let b = move_it!(self.buffer);
@ -779,8 +779,8 @@ fn send_packet<T: send>(p: *packet<T>) -> SendPacket<T> {
} }
struct SendPacketBuffered<T: send, Tbuffer: send> { struct SendPacketBuffered<T: send, Tbuffer: send> {
let mut p: Option<*Packet<T>>; mut p: Option<*Packet<T>>,
let mut buffer: Option<BufferResource<Tbuffer>>; mut buffer: Option<BufferResource<Tbuffer>>,
drop { drop {
//if self.p != none { //if self.p != none {
// debug!("drop send %?", option::get(self.p)); // debug!("drop send %?", option::get(self.p));
@ -860,8 +860,8 @@ fn recv_packet<T: send>(p: *packet<T>) -> RecvPacket<T> {
} }
struct RecvPacketBuffered<T: send, Tbuffer: send> : Selectable { struct RecvPacketBuffered<T: send, Tbuffer: send> : Selectable {
let mut p: Option<*Packet<T>>; mut p: Option<*Packet<T>>,
let mut buffer: Option<BufferResource<Tbuffer>>; mut buffer: Option<BufferResource<Tbuffer>>,
drop { drop {
//if self.p != none { //if self.p != none {
// debug!("drop recv %?", option::get(self.p)); // debug!("drop recv %?", option::get(self.p));
@ -1098,7 +1098,7 @@ impl<T: send> Port<T>: Recv<T> {
/// Treat many ports as one. /// Treat many ports as one.
struct PortSet<T: send> : Recv<T> { struct PortSet<T: send> : Recv<T> {
let mut ports: ~[pipes::Port<T>]; mut ports: ~[pipes::Port<T>],
fn add(+port: pipes::Port<T>) { fn add(+port: pipes::Port<T>) {
vec::push(self.ports, port) vec::push(self.ports, port)

View file

@ -195,7 +195,7 @@ unsafe fn weaken_task(f: fn(comm::Port<()>)) {
f(po); f(po);
struct Unweaken { struct Unweaken {
let ch: comm::Chan<()>; ch: comm::Chan<()>,
drop unsafe { drop unsafe {
rustrt::rust_task_unweaken(unsafe::reinterpret_cast(&self.ch)); rustrt::rust_task_unweaken(unsafe::reinterpret_cast(&self.ch));
} }

View file

@ -244,7 +244,7 @@ impl Rng {
} }
struct RandRes { struct RandRes {
let c: *rctx; c: *rctx,
drop { rustrt::rand_free(self.c); } drop { rustrt::rand_free(self.c); }
} }

View file

@ -227,7 +227,7 @@ fn start_program(prog: &str, args: &[~str]) -> Program {
libc::fclose(r.err_file); libc::fclose(r.err_file);
} }
struct ProgRes { struct ProgRes {
let r: ProgRepr; r: ProgRepr,
drop { destroy_repr(&self.r); } drop { destroy_repr(&self.r); }
} }

View file

@ -7,7 +7,7 @@ use sys::size_of;
type Word = uint; type Word = uint;
struct Frame { struct Frame {
let fp: *Word; fp: *Word
} }
fn Frame(fp: *Word) -> Frame { fn Frame(fp: *Word) -> Frame {

View file

@ -610,7 +610,7 @@ fn get_task() -> Task {
*/ */
unsafe fn unkillable<U>(f: fn() -> U) -> U { unsafe fn unkillable<U>(f: fn() -> U) -> U {
struct AllowFailure { struct AllowFailure {
let t: *rust_task; t: *rust_task,
drop { rustrt::rust_task_allow_kill(self.t); } drop { rustrt::rust_task_allow_kill(self.t); }
} }
@ -629,7 +629,7 @@ unsafe fn unkillable<U>(f: fn() -> U) -> U {
/// The inverse of unkillable. Only ever to be used nested in unkillable(). /// The inverse of unkillable. Only ever to be used nested in unkillable().
unsafe fn rekillable<U>(f: fn() -> U) -> U { unsafe fn rekillable<U>(f: fn() -> U) -> U {
struct DisallowFailure { struct DisallowFailure {
let t: *rust_task; t: *rust_task,
drop { rustrt::rust_task_inhibit_kill(self.t); } drop { rustrt::rust_task_inhibit_kill(self.t); }
} }
@ -651,7 +651,7 @@ unsafe fn rekillable<U>(f: fn() -> U) -> U {
*/ */
unsafe fn atomically<U>(f: fn() -> U) -> U { unsafe fn atomically<U>(f: fn() -> U) -> U {
struct DeferInterrupts { struct DeferInterrupts {
let t: *rust_task; t: *rust_task,
drop { drop {
rustrt::rust_task_allow_yield(self.t); rustrt::rust_task_allow_yield(self.t);
rustrt::rust_task_allow_kill(self.t); rustrt::rust_task_allow_kill(self.t);
@ -948,13 +948,13 @@ fn each_ancestor(list: &mut AncestorList,
// One of these per task. // One of these per task.
struct TCB { struct TCB {
let me: *rust_task; me: *rust_task,
// List of tasks with whose fates this one's is intertwined. // List of tasks with whose fates this one's is intertwined.
let tasks: TaskGroupArc; // 'none' means the group has failed. tasks: TaskGroupArc, // 'none' means the group has failed.
// Lists of tasks who will kill us if they fail, but whom we won't kill. // Lists of tasks who will kill us if they fail, but whom we won't kill.
let mut ancestors: AncestorList; mut ancestors: AncestorList,
let is_main: bool; is_main: bool,
let notifier: Option<AutoNotify>; notifier: Option<AutoNotify>,
// Runs on task exit. // Runs on task exit.
drop { drop {
// If we are failing, the whole taskgroup needs to die. // If we are failing, the whole taskgroup needs to die.
@ -995,8 +995,8 @@ fn TCB(me: *rust_task, +tasks: TaskGroupArc, +ancestors: AncestorList,
} }
struct AutoNotify { struct AutoNotify {
let notify_chan: comm::Chan<Notification>; notify_chan: comm::Chan<Notification>,
let mut failed: bool; mut failed: bool,
drop { drop {
let result = if self.failed { Failure } else { Success }; let result = if self.failed { Failure } else { Success };
comm::send(self.notify_chan, Exit(get_task(), result)); comm::send(self.notify_chan, Exit(get_task(), result));

View file

@ -280,7 +280,7 @@ extern mod rustrt {
} }
struct LittleLock { struct LittleLock {
let l: rust_little_lock; l: rust_little_lock,
drop { rustrt::rust_destroy_little_lock(self.l); } drop { rustrt::rust_destroy_little_lock(self.l); }
} }
@ -294,7 +294,7 @@ impl LittleLock {
#[inline(always)] #[inline(always)]
unsafe fn lock<T>(f: fn() -> T) -> T { unsafe fn lock<T>(f: fn() -> T) -> T {
struct Unlock { struct Unlock {
let l: rust_little_lock; l: rust_little_lock,
drop { rustrt::rust_unlock_little_lock(self.l); } drop { rustrt::rust_unlock_little_lock(self.l); }
} }

View file

@ -43,7 +43,7 @@ enum CVec<T> {
} }
struct DtorRes { struct DtorRes {
let dtor: Option<fn@()>; dtor: Option<fn@()>,
drop { drop {
match self.dtor { match self.dtor {
option::None => (), option::None => (),

View file

@ -39,7 +39,7 @@ extern mod rustrt {
* data structure that is used for read/write operations over a TCP stream. * data structure that is used for read/write operations over a TCP stream.
*/ */
struct TcpSocket { struct TcpSocket {
let socket_data: @TcpSocketData; socket_data: @TcpSocketData,
drop { drop {
unsafe { unsafe {
tear_down_socket_data(self.socket_data) tear_down_socket_data(self.socket_data)
@ -60,7 +60,7 @@ fn TcpSocket(socket_data: @TcpSocketData) -> TcpSocket {
* satisfy both the `io::reader` and `io::writer` traits. * satisfy both the `io::reader` and `io::writer` traits.
*/ */
struct TcpSocketBuf { struct TcpSocketBuf {
let data: @TcpBufferedSocketData; data: @TcpBufferedSocketData,
} }
fn TcpSocketBuf(data: @TcpBufferedSocketData) -> TcpSocketBuf { fn TcpSocketBuf(data: @TcpBufferedSocketData) -> TcpSocketBuf {

View file

@ -129,11 +129,11 @@ fn protocol_(name: ~str, span: span) -> protocol_ {
} }
struct protocol_ { struct protocol_ {
let name: ~str; name: ~str,
let span: span; span: span,
let states: DVec<state>; states: DVec<state>,
let mut bounded: Option<bool>; mut bounded: Option<bool>,
/// Get a state. /// Get a state.
fn get_state(name: ~str) -> state { fn get_state(name: ~str) -> state {

View file

@ -213,21 +213,21 @@ fn parser(sess: parse_sess, cfg: ast::crate_cfg,
} }
struct parser { struct parser {
let sess: parse_sess; sess: parse_sess,
let cfg: crate_cfg; cfg: crate_cfg,
let file_type: file_type; file_type: file_type,
let mut token: token::token; mut token: token::token,
let mut span: span; mut span: span,
let mut last_span: span; mut last_span: span,
let mut buffer: [mut {tok: token::token, sp: span}]/4; mut buffer: [mut {tok: token::token, sp: span}]/4,
let mut buffer_start: int; mut buffer_start: int,
let mut buffer_end: int; mut buffer_end: int,
let mut restriction: restriction; mut restriction: restriction,
let mut quote_depth: uint; // not (yet) related to the quasiquoter mut quote_depth: uint, // not (yet) related to the quasiquoter
let reader: reader; reader: reader,
let interner: interner<@~str>; interner: interner<@~str>,
let keywords: hashmap<~str, ()>; keywords: hashmap<~str, ()>,
let restricted_keywords: hashmap<~str, ()>; restricted_keywords: hashmap<~str, ()>,
drop {} /* do not copy the parser; its state is tied to outside state */ drop {} /* do not copy the parser; its state is tied to outside state */
@ -2726,8 +2726,7 @@ struct parser {
} }
fn parse_single_class_item(vis: visibility) -> @class_member { fn parse_single_class_item(vis: visibility) -> @class_member {
if (self.eat_keyword(~"let") || if (self.token_is_keyword(~"mut", copy self.token) ||
self.token_is_keyword(~"mut", copy self.token) ||
!self.is_any_keyword(copy self.token)) && !self.is_any_keyword(copy self.token)) &&
!self.token_is_pound_or_doc_comment(self.token) { !self.token_is_pound_or_doc_comment(self.token) {
let a_var = self.parse_instance_var(vis); let a_var = self.parse_instance_var(vis);

View file

@ -241,7 +241,7 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
}; };
struct finally { struct finally {
let ch: comm::Chan<monitor_msg>; ch: comm::Chan<monitor_msg>,
drop { comm::send(self.ch, done); } drop { comm::send(self.ch, done); }
} }

View file

@ -1175,7 +1175,7 @@ fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] unsafe {
/* Memory-managed interface to target data. */ /* Memory-managed interface to target data. */
struct target_data_res { struct target_data_res {
let TD: TargetDataRef; TD: TargetDataRef,
drop { llvm::LLVMDisposeTargetData(self.TD); } drop { llvm::LLVMDisposeTargetData(self.TD); }
} }
@ -1196,7 +1196,7 @@ fn mk_target_data(string_rep: ~str) -> target_data {
/* Memory-managed interface to pass managers. */ /* Memory-managed interface to pass managers. */
struct pass_manager_res { struct pass_manager_res {
let PM: PassManagerRef; PM: PassManagerRef,
drop { llvm::LLVMDisposePassManager(self.PM); } drop { llvm::LLVMDisposePassManager(self.PM); }
} }
@ -1216,7 +1216,7 @@ fn mk_pass_manager() -> pass_manager {
/* Memory-managed interface to object files. */ /* Memory-managed interface to object files. */
struct object_file_res { struct object_file_res {
let ObjectFile: ObjectFileRef; ObjectFile: ObjectFileRef,
drop { llvm::LLVMDisposeObjectFile(self.ObjectFile); } drop { llvm::LLVMDisposeObjectFile(self.ObjectFile); }
} }
@ -1237,7 +1237,7 @@ fn mk_object_file(llmb: MemoryBufferRef) -> Option<object_file> {
/* Memory-managed interface to section iterators. */ /* Memory-managed interface to section iterators. */
struct section_iter_res { struct section_iter_res {
let SI: SectionIteratorRef; SI: SectionIteratorRef,
drop { llvm::LLVMDisposeSectionIterator(self.SI); } drop { llvm::LLVMDisposeSectionIterator(self.SI); }
} }

View file

@ -440,9 +440,9 @@ fn def_like_to_def(def_like: def_like) -> ast::def {
// A path. // A path.
struct path_entry { struct path_entry {
// The full path, separated by '::'. // The full path, separated by '::'.
let path_string: ~str; path_string: ~str,
// The definition, implementation, or field that this path corresponds to. // The definition, implementation, or field that this path corresponds to.
let def_like: def_like; def_like: def_like,
} }
fn path_entry(path_string: ~str, def_like: def_like) -> path_entry { fn path_entry(path_string: ~str, def_like: def_like) -> path_entry {

View file

@ -108,12 +108,12 @@ fn LanguageItemCollector(crate: @crate, session: session,
} }
struct LanguageItemCollector { struct LanguageItemCollector {
let items: &LanguageItems; items: &LanguageItems,
let crate: @crate; crate: @crate,
let session: session; session: session,
let item_refs: hashmap<~str,&mut Option<def_id>>; item_refs: hashmap<~str,&mut Option<def_id>>,
fn match_and_collect_meta_item(item_def_id: def_id, fn match_and_collect_meta_item(item_def_id: def_id,
meta_item: meta_item) { meta_item: meta_item) {

View file

@ -604,13 +604,13 @@ const ACC_WRITE: uint = 2u;
const ACC_USE: uint = 4u; const ACC_USE: uint = 4u;
struct Liveness { struct Liveness {
let tcx: ty::ctxt; tcx: ty::ctxt,
let ir: @IrMaps; ir: @IrMaps,
let s: Specials; s: Specials,
let successors: ~[mut LiveNode]; successors: ~[mut LiveNode],
let users: ~[mut users]; users: ~[mut users],
let mut break_ln: LiveNode; mut break_ln: LiveNode,
let mut cont_ln: LiveNode; mut cont_ln: LiveNode,
} }
fn Liveness(ir: @IrMaps, specials: Specials) -> Liveness { fn Liveness(ir: @IrMaps, specials: Specials) -> Liveness {

View file

@ -314,8 +314,8 @@ fn atom_hashmap<V:copy>() -> hashmap<Atom,V> {
/// One local scope. /// One local scope.
struct Rib { struct Rib {
let bindings: hashmap<Atom,def_like>; bindings: hashmap<Atom,def_like>,
let kind: RibKind; kind: RibKind,
} }
fn Rib(kind: RibKind) -> Rib { fn Rib(kind: RibKind) -> Rib {
@ -328,9 +328,9 @@ fn Rib(kind: RibKind) -> Rib {
/// One import directive. /// One import directive.
struct ImportDirective { struct ImportDirective {
let module_path: @DVec<Atom>; module_path: @DVec<Atom>,
let subclass: @ImportDirectiveSubclass; subclass: @ImportDirectiveSubclass,
let span: span; span: span,
} }
fn ImportDirective(module_path: @DVec<Atom>, fn ImportDirective(module_path: @DVec<Atom>,
@ -345,8 +345,8 @@ fn ImportDirective(module_path: @DVec<Atom>,
/// The item that an import resolves to. /// The item that an import resolves to.
struct Target { struct Target {
let target_module: @Module; target_module: @Module,
let bindings: @NameBindings; bindings: @NameBindings,
} }
fn Target(target_module: @Module, bindings: @NameBindings) -> Target { fn Target(target_module: @Module, bindings: @NameBindings) -> Target {
@ -357,19 +357,19 @@ fn Target(target_module: @Module, bindings: @NameBindings) -> Target {
} }
struct ImportResolution { struct ImportResolution {
let span: span; span: span,
// The number of outstanding references to this name. When this reaches // The number of outstanding references to this name. When this reaches
// zero, outside modules can count on the targets being correct. Before // zero, outside modules can count on the targets being correct. Before
// then, all bets are off; future imports could override this name. // then, all bets are off; future imports could override this name.
let mut outstanding_references: uint; mut outstanding_references: uint,
let mut module_target: Option<Target>; mut module_target: Option<Target>,
let mut value_target: Option<Target>; mut value_target: Option<Target>,
let mut type_target: Option<Target>; mut type_target: Option<Target>,
let mut used: bool; mut used: bool,
fn target_for_namespace(namespace: Namespace) -> Option<Target> { fn target_for_namespace(namespace: Namespace) -> Option<Target> {
match namespace { match namespace {
@ -400,11 +400,11 @@ enum ParentLink {
/// One node in the tree of modules. /// One node in the tree of modules.
struct Module { struct Module {
let parent_link: ParentLink; parent_link: ParentLink,
let mut def_id: Option<def_id>; mut def_id: Option<def_id>,
let children: hashmap<Atom,@NameBindings>; children: hashmap<Atom,@NameBindings>,
let imports: DVec<@ImportDirective>; imports: DVec<@ImportDirective>,
// The anonymous children of this node. Anonymous children are pseudo- // The anonymous children of this node. Anonymous children are pseudo-
// modules that are implicitly created around items contained within // modules that are implicitly created around items contained within
@ -421,7 +421,7 @@ struct Module {
// There will be an anonymous module created around `g` with the ID of the // There will be an anonymous module created around `g` with the ID of the
// entry block for `f`. // entry block for `f`.
let anonymous_children: hashmap<node_id,@Module>; anonymous_children: hashmap<node_id,@Module>,
// XXX: This is about to be reworked so that exports are on individual // XXX: This is about to be reworked so that exports are on individual
// items, not names. // items, not names.
@ -429,16 +429,16 @@ struct Module {
// The atom is the name of the exported item, while the node ID is the // The atom is the name of the exported item, while the node ID is the
// ID of the export path. // ID of the export path.
let exported_names: hashmap<Atom,node_id>; exported_names: hashmap<Atom,node_id>,
// The status of resolving each import in this module. // The status of resolving each import in this module.
let import_resolutions: hashmap<Atom,@ImportResolution>; import_resolutions: hashmap<Atom,@ImportResolution>,
// The number of unresolved globs that this module exports. // The number of unresolved globs that this module exports.
let mut glob_count: uint; mut glob_count: uint,
// The index of the import we're resolving. // The index of the import we're resolving.
let mut resolved_import_count: uint; mut resolved_import_count: uint,
fn all_imports_resolved() -> bool { fn all_imports_resolved() -> bool {
return self.imports.len() == self.resolved_import_count; return self.imports.len() == self.resolved_import_count;
@ -500,15 +500,15 @@ struct Definition {
// Records the definitions (at most one for each namespace) that a name is // Records the definitions (at most one for each namespace) that a name is
// bound to. // bound to.
struct NameBindings { struct NameBindings {
let mut module_def: ModuleDef; //< Meaning in module namespace. mut module_def: ModuleDef, //< Meaning in module namespace.
let mut type_def: Option<Definition>; //< Meaning in type namespace. mut type_def: Option<Definition>, //< Meaning in type namespace.
let mut value_def: Option<Definition>; //< Meaning in value namespace. mut value_def: Option<Definition>, //< Meaning in value namespace.
// For error reporting // For error reporting
// XXX: Merge me into Definition. // XXX: Merge me into Definition.
let mut module_span: Option<span>; mut module_span: Option<span>,
let mut type_span: Option<span>; mut type_span: Option<span>,
let mut value_span: Option<span>; mut value_span: Option<span>,
/// Creates a new module in this set of name bindings. /// Creates a new module in this set of name bindings.
fn define_module(parent_link: ParentLink, def_id: Option<def_id>, fn define_module(parent_link: ParentLink, def_id: Option<def_id>,
@ -612,7 +612,7 @@ fn NameBindings() -> NameBindings {
/// Interns the names of the primitive types. /// Interns the names of the primitive types.
struct PrimitiveTypeTable { struct PrimitiveTypeTable {
let primitive_types: hashmap<Atom,prim_ty>; primitive_types: hashmap<Atom,prim_ty>,
fn intern(intr: ident_interner, string: @~str, fn intern(intr: ident_interner, string: @~str,
primitive_type: prim_ty) { primitive_type: prim_ty) {
@ -710,55 +710,55 @@ fn Resolver(session: session, lang_items: LanguageItems,
/// The main resolver class. /// The main resolver class.
struct Resolver { struct Resolver {
let session: session; session: session,
let lang_items: LanguageItems; lang_items: LanguageItems,
let crate: @crate; crate: @crate,
let intr: ident_interner; intr: ident_interner,
let graph_root: @NameBindings; graph_root: @NameBindings,
let unused_import_lint_level: level; unused_import_lint_level: level,
let trait_info: hashmap<def_id,@hashmap<Atom,()>>; trait_info: hashmap<def_id,@hashmap<Atom,()>>,
let structs: hashmap<def_id,bool>; structs: hashmap<def_id,bool>,
// The number of imports that are currently unresolved. // The number of imports that are currently unresolved.
let mut unresolved_imports: uint; mut unresolved_imports: uint,
// The module that represents the current item scope. // The module that represents the current item scope.
let mut current_module: @Module; mut current_module: @Module,
// The current set of local scopes, for values. // The current set of local scopes, for values.
// XXX: Reuse ribs to avoid allocation. // XXX: Reuse ribs to avoid allocation.
let value_ribs: @DVec<@Rib>; value_ribs: @DVec<@Rib>,
// The current set of local scopes, for types. // The current set of local scopes, for types.
let type_ribs: @DVec<@Rib>; type_ribs: @DVec<@Rib>,
// The current set of local scopes, for labels. // The current set of local scopes, for labels.
let label_ribs: @DVec<@Rib>; label_ribs: @DVec<@Rib>,
// Whether the current context is an X-ray context. An X-ray context is // Whether the current context is an X-ray context. An X-ray context is
// allowed to access private names of any module. // allowed to access private names of any module.
let mut xray_context: XrayFlag; mut xray_context: XrayFlag,
// The trait that the current context can refer to. // The trait that the current context can refer to.
let mut current_trait_refs: Option<@DVec<def_id>>; mut current_trait_refs: Option<@DVec<def_id>>,
// The atom for the keyword "self". // The atom for the keyword "self".
let self_atom: Atom; self_atom: Atom,
// The atoms for the primitive types. // The atoms for the primitive types.
let primitive_type_table: @PrimitiveTypeTable; primitive_type_table: @PrimitiveTypeTable,
// The four namespaces. // The four namespaces.
let namespaces: ~[Namespace]; namespaces: ~[Namespace],
let def_map: DefMap; def_map: DefMap,
let export_map: ExportMap; export_map: ExportMap,
let export_map2: ExportMap2; export_map2: ExportMap2,
let trait_map: TraitMap; trait_map: TraitMap,
/// The main name resolution procedure. /// The main name resolution procedure.
fn resolve(@self, this: @Resolver) { fn resolve(@self, this: @Resolver) {

View file

@ -55,7 +55,7 @@ use std::smallintmap;
use option::{is_none, is_some}; use option::{is_none, is_some};
struct icx_popper { struct icx_popper {
let ccx: @crate_ctxt; ccx: @crate_ctxt,
drop { drop {
if self.ccx.sess.count_llvm_insns() { if self.ccx.sess.count_llvm_insns() {
vec::pop(*(self.ccx.stats.llvm_insn_ctxt)); vec::pop(*(self.ccx.stats.llvm_insn_ctxt));

View file

@ -94,7 +94,7 @@ type stats =
fn_times: @mut ~[{ident: ~str, time: int}]}; fn_times: @mut ~[{ident: ~str, time: int}]};
struct BuilderRef_res { struct BuilderRef_res {
let B: BuilderRef; B: BuilderRef,
drop { llvm::LLVMDisposeBuilder(self.B); } drop { llvm::LLVMDisposeBuilder(self.B); }
} }
@ -482,19 +482,19 @@ struct block_ {
// block to the function pointed to by llfn. We insert // block to the function pointed to by llfn. We insert
// instructions into that block by way of this block context. // instructions into that block by way of this block context.
// The block pointing to this one in the function's digraph. // The block pointing to this one in the function's digraph.
let llbb: BasicBlockRef; llbb: BasicBlockRef,
let mut terminated: bool; mut terminated: bool,
let mut unreachable: bool; mut unreachable: bool,
let parent: Option<block>; parent: Option<block>,
// The 'kind' of basic block this is. // The 'kind' of basic block this is.
let kind: block_kind; kind: block_kind,
// Is this block part of a landing pad? // Is this block part of a landing pad?
let is_lpad: bool; is_lpad: bool,
// info about the AST node this block originated from, if any // info about the AST node this block originated from, if any
let node_info: Option<node_info>; node_info: Option<node_info>,
// The function context for the function to which this block is // The function context for the function to which this block is
// attached. // attached.
let fcx: fn_ctxt; fcx: fn_ctxt
} }
fn block_(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind, fn block_(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,

View file

@ -93,18 +93,18 @@ fn lookup(fcx: @fn_ctxt,
} }
struct lookup { struct lookup {
let fcx: @fn_ctxt; fcx: @fn_ctxt,
let expr: @ast::expr; expr: @ast::expr,
let self_expr: @ast::expr; self_expr: @ast::expr,
let borrow_lb: ast::node_id; borrow_lb: ast::node_id,
let node_id: ast::node_id; node_id: ast::node_id,
let m_name: ast::ident; m_name: ast::ident,
let mut self_ty: ty::t; mut self_ty: ty::t,
let mut derefs: uint; mut derefs: uint,
let candidates: DVec<candidate>; candidates: DVec<candidate>,
let candidate_impls: hashmap<def_id, ()>; candidate_impls: hashmap<def_id, ()>,
let supplied_tps: ~[ty::t]; supplied_tps: ~[ty::t],
let include_private: bool; include_private: bool,
// Entrypoint: // Entrypoint:
fn method() -> Option<method_map_entry> { fn method() -> Option<method_map_entry> {

View file

@ -121,11 +121,11 @@ fn method_to_MethodInfo(ast_method: @method) -> @MethodInfo {
struct CoherenceInfo { struct CoherenceInfo {
// Contains implementations of methods that are inherent to a type. // Contains implementations of methods that are inherent to a type.
// Methods in these implementations don't need to be exported. // Methods in these implementations don't need to be exported.
let inherent_methods: hashmap<def_id,@DVec<@Impl>>; inherent_methods: hashmap<def_id,@DVec<@Impl>>,
// Contains implementations of methods associated with a trait. For these, // Contains implementations of methods associated with a trait. For these,
// the associated trait must be imported at the call site. // the associated trait must be imported at the call site.
let extension_methods: hashmap<def_id,@DVec<@Impl>>; extension_methods: hashmap<def_id,@DVec<@Impl>>,
} }
fn CoherenceInfo() -> CoherenceInfo { fn CoherenceInfo() -> CoherenceInfo {
@ -146,18 +146,18 @@ fn CoherenceChecker(crate_context: @crate_ctxt) -> CoherenceChecker {
} }
struct CoherenceChecker { struct CoherenceChecker {
let crate_context: @crate_ctxt; crate_context: @crate_ctxt,
let inference_context: infer_ctxt; inference_context: infer_ctxt,
// A mapping from implementations to the corresponding base type // A mapping from implementations to the corresponding base type
// definition ID. // definition ID.
let base_type_def_ids: hashmap<def_id,def_id>; base_type_def_ids: hashmap<def_id,def_id>,
// A set of implementations in privileged scopes; i.e. those // A set of implementations in privileged scopes; i.e. those
// implementations that are defined in the same scope as their base types. // implementations that are defined in the same scope as their base types.
let privileged_implementations: hashmap<node_id,()>; privileged_implementations: hashmap<node_id,()>,
// Create a mapping containing a MethodInfo for every provided // Create a mapping containing a MethodInfo for every provided
// method in every trait. // method in every trait.

View file

@ -15,7 +15,7 @@ fn indent<R>(op: fn() -> R) -> R {
} }
struct _indenter { struct _indenter {
let _i: (); _i: (),
drop { debug!("<<"); } drop { debug!("<<"); }
} }

View file

@ -112,7 +112,7 @@ mod blade_runner {
* condimentum lacinia tincidunt. * condimentum lacinia tincidunt.
*/ */
struct bored { struct bored {
let bored: bool; bored: bool,
drop { log(error, self.bored); } drop { log(error, self.bored); }
} }

View file

@ -2,10 +2,10 @@ mod kitties {
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
} }

View file

@ -2,10 +2,10 @@ mod kitties {
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn speak() {} fn speak() {}
} }

View file

@ -2,10 +2,10 @@ mod kitties {
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn speak() { self.meows += 1u; } fn speak() { self.meows += 1u; }
fn meow_count() -> uint { self.meows } fn meow_count() -> uint { self.meows }

View file

@ -2,7 +2,7 @@ mod kitties {
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -12,8 +12,8 @@ struct cat {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : ~str; name : ~str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -2,11 +2,11 @@ mod kitties {
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
fn nap() { for uint::range(1u, 10000u) |_i|{}} fn nap() { for uint::range(1u, 10000u) |_i|{}}
} }
let how_hungry : int; how_hungry : int,
} }

View file

@ -2,11 +2,11 @@ mod kitties {
struct cat<U> { struct cat<U> {
priv { priv {
let mut info : ~[U]; mut info : ~[U],
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn speak<T>(stuff: ~[T]) { fn speak<T>(stuff: ~[T]) {
self.meows += stuff.len(); self.meows += stuff.len();

View file

@ -5,7 +5,7 @@ mod kitty {
struct cat : ToStr { struct cat : ToStr {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -15,8 +15,8 @@ struct cat : ToStr {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : ~str; name : ~str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -8,7 +8,7 @@ use std;
export context; export context;
struct arc_destruct<T:const> { struct arc_destruct<T:const> {
let _data: int; _data: int,
drop {} drop {}
} }
@ -27,7 +27,7 @@ fn init() -> arc_destruct<context_res> unsafe {
} }
struct context_res { struct context_res {
let ctx : int; ctx : int,
drop { } drop { }
} }

View file

@ -6,7 +6,7 @@ mod socket {
export socket_handle; export socket_handle;
struct socket_handle { struct socket_handle {
let sockfd: libc::c_int; sockfd: libc::c_int,
drop { /* c::close(self.sockfd); */ } drop { /* c::close(self.sockfd); */ }
} }

View file

@ -4,7 +4,7 @@ fn foo(_x: i32) {
} }
struct rsrc { struct rsrc {
let x: i32; x: i32,
drop { foo(self.x); } drop { foo(self.x); }
} }

View file

@ -28,7 +28,7 @@ fn port<T: send>() -> port<T> {
} }
struct port_ptr<T:send> { struct port_ptr<T:send> {
let po: *rust_port; po: *rust_port,
drop unsafe { drop unsafe {
debug!("in the port_ptr destructor"); debug!("in the port_ptr destructor");
do task::unkillable { do task::unkillable {

View file

@ -41,7 +41,7 @@ enum st {
} }
struct r { struct r {
let _l: @nillist; _l: @nillist,
drop {} drop {}
} }

View file

@ -97,7 +97,7 @@ fn reduce(&&word: ~str, get: map_reduce::getter<int>) {
} }
struct box<T> { struct box<T> {
let mut contents: Option<T>; mut contents: Option<T>,
fn swap(f: fn(+T) -> T) { fn swap(f: fn(+T) -> T) {
let mut tmp = None; let mut tmp = None;
@ -348,8 +348,8 @@ fn is_word_char(c: char) -> bool {
} }
struct random_word_reader: word_reader { struct random_word_reader: word_reader {
let mut remaining: uint; mut remaining: uint,
let rng: rand::Rng; rng: rand::Rng,
fn read_word() -> Option<~str> { fn read_word() -> Option<~str> {
if self.remaining > 0 { if self.remaining > 0 {

View file

@ -1,9 +1,9 @@
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint
} }
let how_hungry : int; how_hungry : int,
fn speak() { self.meows += 1u; } fn speak() { self.meows += 1u; }
} }

View file

@ -1,6 +1,6 @@
// error-pattern: copying a noncopyable value // error-pattern: copying a noncopyable value
struct foo { let x: int; drop { } } struct foo { x: int, drop { } }
fn foo(x: int) -> foo { fn foo(x: int) -> foo {
foo { foo {

View file

@ -5,7 +5,7 @@ trait noisy {
struct cat : noisy { struct cat : noisy {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -15,8 +15,8 @@ struct cat : noisy {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : str; name : str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -1,5 +1,5 @@
struct cat : int { //~ ERROR trait struct cat : int { //~ ERROR trait
let meows: uint; meows: uint,
} }
fn cat(in_x : uint) -> cat { fn cat(in_x : uint) -> cat {

View file

@ -4,7 +4,7 @@ trait animal {
} }
struct cat : animal { struct cat : animal {
let meows: uint; meows: uint,
} }
fn cat(in_x : uint) -> cat { fn cat(in_x : uint) -> cat {

View file

@ -1,6 +1,6 @@
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
fn sleep() { loop{} } fn sleep() { loop{} }
fn meow() { fn meow() {
error!("Meow"); error!("Meow");

View file

@ -1,7 +1,7 @@
// error-pattern: copying a noncopyable value // error-pattern: copying a noncopyable value
struct foo { struct foo {
let i: int; i: int,
drop {} drop {}
} }

View file

@ -2,8 +2,8 @@
// cause compiler to loop. Note that no instances // cause compiler to loop. Note that no instances
// of such a type could ever be constructed. // of such a type could ever be constructed.
struct t { //~ ERROR this type cannot be instantiated struct t { //~ ERROR this type cannot be instantiated
let x: x; x: x,
let to_str: (); to_str: (),
} }
enum x = @t; //~ ERROR this type cannot be instantiated enum x = @t; //~ ERROR this type cannot be instantiated

View file

@ -1,5 +1,5 @@
struct socket { struct socket {
let sock: int; sock: int,
drop { } drop { }

View file

@ -1,5 +1,5 @@
struct send_packet<T: copy> { struct send_packet<T: copy> {
let p: T; p: T
} }

View file

@ -1,5 +1,5 @@
struct example { struct example {
let x: int; x: int,
drop {} //~ ERROR First destructor declared drop {} //~ ERROR First destructor declared
drop { drop {
debug!("Goodbye, cruel world"); debug!("Goodbye, cruel world");

View file

@ -3,7 +3,7 @@ use std;
fn siphash(k0 : u64) { fn siphash(k0 : u64) {
struct siphash { struct siphash {
let mut v0: u64; mut v0: u64,
fn reset() { fn reset() {
self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR attempted dynamic environment-capture self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR attempted dynamic environment-capture
//~^ ERROR unresolved name: k0 //~^ ERROR unresolved name: k0

View file

@ -1,6 +1,6 @@
#[forbid(non_camel_case_types)] #[forbid(non_camel_case_types)]
struct foo { //~ ERROR type, variant, or trait must be camel case struct foo { //~ ERROR type, variant, or trait must be camel case
let bar: int; bar: int,
} }
fn main() { fn main() {

View file

@ -49,7 +49,7 @@ fn f4b() -> int {
// leave this in here just to trigger compile-fail: // leave this in here just to trigger compile-fail:
struct r { struct r {
let x: (); x: (),
drop {} drop {}
} }
fn main() { fn main() {

View file

@ -1,10 +1,10 @@
// error-pattern:assigning to immutable field // error-pattern:assigning to immutable field
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn eat() { fn eat() {
self.how_hungry -= 5; self.how_hungry -= 5;

View file

@ -1,10 +1,10 @@
// error-pattern:assigning to immutable field // error-pattern:assigning to immutable field
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
} }

View file

@ -1,6 +1,6 @@
fn main() { fn main() {
struct foo { struct foo {
let _x: comm::Port<()>; _x: comm::Port<()>,
drop {} drop {}
} }

View file

@ -3,7 +3,7 @@
fn foo<T: const>(_x: T) { } fn foo<T: const>(_x: T) { }
struct r { struct r {
let x:int; x:int,
drop {} drop {}
} }
@ -14,7 +14,7 @@ fn r(x:int) -> r {
} }
struct r2 { struct r2 {
let x:@mut int; x:@mut int,
drop {} drop {}
} }

View file

@ -3,7 +3,7 @@
// Test that a class with a non-copyable field can't be // Test that a class with a non-copyable field can't be
// copied // copied
struct bar { struct bar {
let x: int; x: int,
drop {} drop {}
} }
@ -14,8 +14,8 @@ fn bar(x:int) -> bar {
} }
struct foo { struct foo {
let i: int; i: int,
let j: bar; j: bar,
} }
fn foo(i:int) -> foo { fn foo(i:int) -> foo {

View file

@ -1,7 +1,7 @@
// error-pattern: copying a noncopyable value // error-pattern: copying a noncopyable value
struct r { struct r {
let i: @mut int; i: @mut int,
drop { *(self.i) = *(self.i) + 1; } drop { *(self.i) = *(self.i) + 1; }
} }

View file

@ -1,11 +1,11 @@
// error-pattern:call to private method not allowed // error-pattern:call to private method not allowed
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
fn nap() { uint::range(1u, 10000u, |_i|{})} fn nap() { uint::range(1u, 10000u, |_i|{})}
} }
let how_hungry : int; how_hungry : int,
} }

View file

@ -1,7 +1,7 @@
// error-pattern: copying a noncopyable value // error-pattern: copying a noncopyable value
struct my_resource { struct my_resource {
let x: int; x: int,
drop { log(error, self.x); } drop { log(error, self.x); }
} }

View file

@ -1,5 +1,5 @@
struct dog { struct dog {
let mut cats_chased: uint; mut cats_chased: uint,
fn chase_cat() { fn chase_cat() {
let p: &static/mut uint = &mut self.cats_chased; //~ ERROR illegal borrow let p: &static/mut uint = &mut self.cats_chased; //~ ERROR illegal borrow

View file

@ -1,5 +1,5 @@
struct dog { struct dog {
let mut food: uint; mut food: uint,
fn chase_cat() { fn chase_cat() {
for uint::range(0u, 10u) |_i| { for uint::range(0u, 10u) |_i| {

View file

@ -4,7 +4,7 @@
enum an_enum = &int; enum an_enum = &int;
trait a_trait { fn foo() -> &self/int; } trait a_trait { fn foo() -> &self/int; }
struct a_class { let x:&self/int; } struct a_class { x:&self/int }
fn a_fn1(e: an_enum/&a) -> an_enum/&b { fn a_fn1(e: an_enum/&a) -> an_enum/&b {
return e; //~ ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a` return e; //~ ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a`

View file

@ -1,15 +1,15 @@
struct yes0 { struct yes0 {
let x: &uint; x: &uint,
drop {} drop {}
} }
struct yes1 { struct yes1 {
let x: &self/uint; x: &self/uint,
drop {} drop {}
} }
struct yes2 { struct yes2 {
let x: &foo/uint; //~ ERROR named regions other than `self` are not allowed as part of a type declaration x: &foo/uint, //~ ERROR named regions other than `self` are not allowed as part of a type declaration
drop {} drop {}
} }

View file

@ -1,5 +1,5 @@
struct box_impl<T> { struct box_impl<T> {
let mut f: T; mut f: T,
} }
fn box_impl<T>(f: T) -> box_impl<T> { fn box_impl<T>(f: T) -> box_impl<T> {

View file

@ -1,7 +1,7 @@
// error-pattern: copying a noncopyable value // error-pattern: copying a noncopyable value
struct r { struct r {
let b:bool; b:bool,
drop {} drop {}
} }

View file

@ -1,7 +1,7 @@
// error-pattern: copying a noncopyable value // error-pattern: copying a noncopyable value
struct r { struct r {
let i: @mut int; i: @mut int,
drop { *(self.i) = *(self.i) + 1; } drop { *(self.i) = *(self.i) + 1; }
} }

View file

@ -2,8 +2,8 @@
// sent // sent
struct foo { struct foo {
let i: int; i: int,
let j: @~str; j: @~str,
} }
fn foo(i:int, j: @~str) -> foo { fn foo(i:int, j: @~str) -> foo {

View file

@ -21,7 +21,7 @@ fn getbig_call_c_and_fail(i: int) {
} }
struct and_then_get_big_again { struct and_then_get_big_again {
let x:int; x:int,
drop { drop {
fn getbig(i: int) { fn getbig(i: int) {
if i != 0 { if i != 0 {

View file

@ -14,7 +14,7 @@ fn getbig_and_fail(&&i: int) {
} }
struct and_then_get_big_again { struct and_then_get_big_again {
let x:int; x:int,
drop { drop {
fn getbig(i: int) { fn getbig(i: int) {
if i != 0 { if i != 0 {

View file

@ -14,7 +14,7 @@ fn getbig_and_fail(&&i: int) {
} }
struct and_then_get_big_again { struct and_then_get_big_again {
let x:int; x:int,
drop {} drop {}
} }

View file

@ -1,7 +1,7 @@
// error-pattern:whatever // error-pattern:whatever
struct r { struct r {
let x:int; x:int,
// Setting the exit status after the runtime has already // Setting the exit status after the runtime has already
// failed has no effect and the process exits with the // failed has no effect and the process exits with the
// runtime's exit code // runtime's exit code

View file

@ -5,7 +5,7 @@ fn failfn() {
} }
struct r { struct r {
let v: *int; v: *int,
drop unsafe { drop unsafe {
let _v2: ~int = unsafe::reinterpret_cast(&self.v); let _v2: ~int = unsafe::reinterpret_cast(&self.v);
} }

View file

@ -78,8 +78,8 @@ extern mod test {
} }
struct p { struct p {
let mut x: int; mut x: int,
let mut y: int; mut y: int,
} }
fn p(x: int, y: int) -> p { fn p(x: int, y: int) -> p {

View file

@ -8,7 +8,7 @@ type Tree<T> = {
fn empty<T>() -> Tree<T> { fail } fn empty<T>() -> Tree<T> { fail }
struct Box { struct Box {
let tree: Tree<@Box>; tree: Tree<@Box>
} }
fn Box() -> Box { fn Box() -> Box {

View file

@ -1,5 +1,5 @@
struct cat { struct cat {
let name: ~str; name: ~str,
#[cat_dropper] #[cat_dropper]
/** /**
Actually, cats don't always land on their feet when you drop them. Actually, cats don't always land on their feet when you drop them.

View file

@ -4,7 +4,7 @@ trait noisy {
struct dog : noisy { struct dog : noisy {
priv { priv {
let barks : @mut uint; barks : @mut uint,
fn bark() -> int { fn bark() -> int {
debug!("Woof %u %d", *self.barks, *self.volume); debug!("Woof %u %d", *self.barks, *self.volume);
*self.barks += 1u; *self.barks += 1u;
@ -19,7 +19,7 @@ struct dog : noisy {
} }
} }
let volume : @mut int; volume : @mut int,
fn speak() -> int { self.bark() } fn speak() -> int { self.bark() }
} }
@ -33,7 +33,7 @@ fn dog() -> dog {
struct cat : noisy { struct cat : noisy {
priv { priv {
let meows : @mut uint; meows : @mut uint,
fn meow() -> uint { fn meow() -> uint {
debug!("Meow"); debug!("Meow");
*self.meows += 1u; *self.meows += 1u;
@ -44,8 +44,8 @@ struct cat : noisy {
} }
} }
let how_hungry : @mut int; how_hungry : @mut int,
let name : ~str; name : ~str,
fn speak() -> int { self.meow() as int } fn speak() -> int { self.meow() as int }
fn meow_count() -> uint { *self.meows } fn meow_count() -> uint { *self.meows }

View file

@ -4,7 +4,7 @@ trait noisy {
struct cat : noisy { struct cat : noisy {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -14,8 +14,8 @@ struct cat : noisy {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : ~str; name : ~str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -1,6 +1,6 @@
struct cat { struct cat {
let done : extern fn(uint); done : extern fn(uint),
let meows : uint; meows : uint,
drop { self.done(self.meows); } drop { self.done(self.meows); }
} }

View file

@ -6,8 +6,8 @@ use kitty::*;
mod kitty { mod kitty {
export cat; export cat;
struct cat { struct cat {
let meows: uint; meows: uint,
let name: ~str; name: ~str,
fn get_name() -> ~str { self.name } fn get_name() -> ~str { self.name }
} }

View file

@ -17,7 +17,7 @@ impl cat_type : cmp::Eq {
struct cat<T: copy> : map<int, T> { struct cat<T: copy> : map<int, T> {
priv { priv {
// Yes, you can have negative meows // Yes, you can have negative meows
let mut meows : int; mut meows : int,
fn meow() { fn meow() {
self.meows += 1; self.meows += 1;
error!("Meow %d", self.meows); error!("Meow %d", self.meows);
@ -27,8 +27,8 @@ struct cat<T: copy> : map<int, T> {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : T; name : T,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -5,7 +5,7 @@ use cci_class_trait::animals::*;
struct cat : noisy { struct cat : noisy {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -15,8 +15,8 @@ struct cat : noisy {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : ~str; name : ~str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -4,7 +4,7 @@ trait noisy {
struct cat : noisy { struct cat : noisy {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -14,8 +14,8 @@ struct cat : noisy {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : ~str; name : ~str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -1,9 +1,9 @@
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn speak() { self.meows += 1u; } fn speak() { self.meows += 1u; }
fn meow_count() -> uint { self.meows } fn meow_count() -> uint { self.meows }

View file

@ -1,10 +1,10 @@
struct cat<U> { struct cat<U> {
priv { priv {
let mut info : ~[U]; mut info : ~[U],
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn speak<T>(stuff: ~[T]) { fn speak<T>(stuff: ~[T]) {
self.meows += stuff.len(); self.meows += stuff.len();

View file

@ -4,7 +4,7 @@ use to_str::ToStr;
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -14,8 +14,8 @@ struct cat {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : ~str; name : ~str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -1,6 +1,6 @@
struct cat { struct cat {
let name : ~str; name : ~str,
} }

View file

@ -1,9 +1,9 @@
struct cat<U> { struct cat<U> {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn speak() { fn speak() {
self.meows += 1u; self.meows += 1u;

View file

@ -1,5 +1,5 @@
struct kitten { struct kitten {
let cat: Option<cat>; cat: Option<cat>,
} }
fn kitten(cat: Option<cat>) -> kitten { fn kitten(cat: Option<cat>) -> kitten {

View file

@ -1,9 +1,9 @@
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
fn speak() {} fn speak() {}
} }

View file

@ -1,9 +1,9 @@
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
} }
let how_hungry : int; how_hungry : int,
} }

View file

@ -1,6 +1,6 @@
struct cat { struct cat {
priv { priv {
let mut meows : uint; mut meows : uint,
fn meow() { fn meow() {
error!("Meow"); error!("Meow");
self.meows += 1u; self.meows += 1u;
@ -10,8 +10,8 @@ struct cat {
} }
} }
let mut how_hungry : int; mut how_hungry : int,
let name : ~str; name : ~str,
fn speak() { self.meow(); } fn speak() { self.meow(); }

View file

@ -26,7 +26,7 @@ enum tg { bar, }
#[cfg(bogus)] #[cfg(bogus)]
struct r { struct r {
let i: int; i: int,
} }
#[cfg(bogus)] #[cfg(bogus)]
@ -37,7 +37,7 @@ fn r(i:int) -> r {
} }
struct r { struct r {
let i: int; i: int,
} }
fn r(i:int) -> r { fn r(i:int) -> r {

View file

@ -2,7 +2,7 @@
// as a move unless the stored thing is used afterwards. // as a move unless the stored thing is used afterwards.
struct r { struct r {
let i: @mut int; i: @mut int,
drop { *(self.i) = *(self.i) + 1; } drop { *(self.i) = *(self.i) + 1; }
} }

View file

@ -2,7 +2,7 @@ trait clam<A: copy> {
fn chowder(y: A); fn chowder(y: A);
} }
struct foo<A: copy> : clam<A> { struct foo<A: copy> : clam<A> {
let x: A; x: A,
fn chowder(y: A) { fn chowder(y: A) {
} }
} }

View file

@ -1,6 +1,6 @@
trait clam<A: copy> { } trait clam<A: copy> { }
struct foo<A: copy> { struct foo<A: copy> {
let x: A; x: A,
fn bar<B,C:clam<A>>(c: C) -> B { fn bar<B,C:clam<A>>(c: C) -> B {
fail; fail;
} }

View file

@ -1,5 +1,5 @@
struct c1<T: copy> { struct c1<T: copy> {
let x: T; x: T,
fn f1(x: int) { fn f1(x: int) {
} }
} }

View file

@ -1,7 +1,7 @@
use dvec::DVec; use dvec::DVec;
struct c1<T: copy> { struct c1<T: copy> {
let x: T; x: T,
fn f1(x: T) {} fn f1(x: T) {}
} }

Some files were not shown because too many files have changed in this diff Show more