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> {
let po: *rust_port;
po: *rust_port,
drop unsafe {
do task::unkillable {
// 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 {
struct PortRef {
let p: *rust_port;
p: *rust_port,
drop {
if !ptr::is_null(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
struct StackSegment {
let prev: *StackSegment;
let next: *StackSegment;
let end: uintptr_t;
prev: *StackSegment,
next: *StackSegment,
end: uintptr_t,
// 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 {
let f: *libc::FILE;
f: *libc::FILE,
drop { libc::fclose(self.f); }
}
@ -422,7 +422,7 @@ impl fd_t: Writer {
}
struct FdRes {
let fd: fd_t;
fd: fd_t,
drop { libc::close(self.fd); }
}
@ -778,7 +778,7 @@ mod fsync {
// Artifacts that need to fsync on destruction
struct Res<t> {
let arg: Arg<t>;
arg: Arg<t>,
drop {
match self.arg.opt_level {
option::None => (),

View File

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

View File

@ -134,7 +134,7 @@ impl State: Eq {
struct BufferHeader {
// Tracks whether this buffer needs to be freed. We can probably
// 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
// thing along.
@ -158,12 +158,12 @@ type Buffer<T: send> = {
};
struct PacketHeader {
let mut state: State;
let mut blocked_task: *rust_task;
mut state: State,
mut blocked_task: *rust_task,
// This is a reinterpret_cast of a ~buffer, that can also be cast
// to a buffer_header if need be.
let mut buffer: *libc::c_void;
mut buffer: *libc::c_void,
// Returns the old 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!().
struct BufferResource<T: send> {
let buffer: ~Buffer<T>;
buffer: ~Buffer<T>,
drop unsafe {
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> {
let mut p: Option<*Packet<T>>;
let mut buffer: Option<BufferResource<Tbuffer>>;
mut p: Option<*Packet<T>>,
mut buffer: Option<BufferResource<Tbuffer>>,
drop {
//if self.p != none {
// 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 {
let mut p: Option<*Packet<T>>;
let mut buffer: Option<BufferResource<Tbuffer>>;
mut p: Option<*Packet<T>>,
mut buffer: Option<BufferResource<Tbuffer>>,
drop {
//if self.p != none {
// debug!("drop recv %?", option::get(self.p));
@ -1098,7 +1098,7 @@ impl<T: send> Port<T>: Recv<T> {
/// Treat many ports as one.
struct PortSet<T: send> : Recv<T> {
let mut ports: ~[pipes::Port<T>];
mut ports: ~[pipes::Port<T>],
fn add(+port: pipes::Port<T>) {
vec::push(self.ports, port)

View File

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

View File

@ -244,7 +244,7 @@ impl Rng {
}
struct RandRes {
let c: *rctx;
c: *rctx,
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);
}
struct ProgRes {
let r: ProgRepr;
r: ProgRepr,
drop { destroy_repr(&self.r); }
}

View File

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

View File

@ -610,7 +610,7 @@ fn get_task() -> Task {
*/
unsafe fn unkillable<U>(f: fn() -> U) -> U {
struct AllowFailure {
let t: *rust_task;
t: *rust_task,
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().
unsafe fn rekillable<U>(f: fn() -> U) -> U {
struct DisallowFailure {
let t: *rust_task;
t: *rust_task,
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 {
struct DeferInterrupts {
let t: *rust_task;
t: *rust_task,
drop {
rustrt::rust_task_allow_yield(self.t);
rustrt::rust_task_allow_kill(self.t);
@ -948,13 +948,13 @@ fn each_ancestor(list: &mut AncestorList,
// One of these per task.
struct TCB {
let me: *rust_task;
me: *rust_task,
// 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.
let mut ancestors: AncestorList;
let is_main: bool;
let notifier: Option<AutoNotify>;
mut ancestors: AncestorList,
is_main: bool,
notifier: Option<AutoNotify>,
// Runs on task exit.
drop {
// 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 {
let notify_chan: comm::Chan<Notification>;
let mut failed: bool;
notify_chan: comm::Chan<Notification>,
mut failed: bool,
drop {
let result = if self.failed { Failure } else { Success };
comm::send(self.notify_chan, Exit(get_task(), result));

View File

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

View File

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

View File

@ -39,7 +39,7 @@ extern mod rustrt {
* data structure that is used for read/write operations over a TCP stream.
*/
struct TcpSocket {
let socket_data: @TcpSocketData;
socket_data: @TcpSocketData,
drop {
unsafe {
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.
*/
struct TcpSocketBuf {
let data: @TcpBufferedSocketData;
data: @TcpBufferedSocketData,
}
fn TcpSocketBuf(data: @TcpBufferedSocketData) -> TcpSocketBuf {

View File

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

View File

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

View File

@ -241,7 +241,7 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
};
struct finally {
let ch: comm::Chan<monitor_msg>;
ch: comm::Chan<monitor_msg>,
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. */
struct target_data_res {
let TD: TargetDataRef;
TD: TargetDataRef,
drop { llvm::LLVMDisposeTargetData(self.TD); }
}
@ -1196,7 +1196,7 @@ fn mk_target_data(string_rep: ~str) -> target_data {
/* Memory-managed interface to pass managers. */
struct pass_manager_res {
let PM: PassManagerRef;
PM: PassManagerRef,
drop { llvm::LLVMDisposePassManager(self.PM); }
}
@ -1216,7 +1216,7 @@ fn mk_pass_manager() -> pass_manager {
/* Memory-managed interface to object files. */
struct object_file_res {
let ObjectFile: ObjectFileRef;
ObjectFile: ObjectFileRef,
drop { llvm::LLVMDisposeObjectFile(self.ObjectFile); }
}
@ -1237,7 +1237,7 @@ fn mk_object_file(llmb: MemoryBufferRef) -> Option<object_file> {
/* Memory-managed interface to section iterators. */
struct section_iter_res {
let SI: SectionIteratorRef;
SI: SectionIteratorRef,
drop { llvm::LLVMDisposeSectionIterator(self.SI); }
}

View File

@ -440,9 +440,9 @@ fn def_like_to_def(def_like: def_like) -> ast::def {
// A path.
struct path_entry {
// The full path, separated by '::'.
let path_string: ~str;
path_string: ~str,
// 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 {

View File

@ -108,12 +108,12 @@ fn LanguageItemCollector(crate: @crate, session: session,
}
struct LanguageItemCollector {
let items: &LanguageItems;
items: &LanguageItems,
let crate: @crate;
let session: session;
crate: @crate,
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,
meta_item: meta_item) {

View File

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

View File

@ -314,8 +314,8 @@ fn atom_hashmap<V:copy>() -> hashmap<Atom,V> {
/// One local scope.
struct Rib {
let bindings: hashmap<Atom,def_like>;
let kind: RibKind;
bindings: hashmap<Atom,def_like>,
kind: RibKind,
}
fn Rib(kind: RibKind) -> Rib {
@ -328,9 +328,9 @@ fn Rib(kind: RibKind) -> Rib {
/// One import directive.
struct ImportDirective {
let module_path: @DVec<Atom>;
let subclass: @ImportDirectiveSubclass;
let span: span;
module_path: @DVec<Atom>,
subclass: @ImportDirectiveSubclass,
span: span,
}
fn ImportDirective(module_path: @DVec<Atom>,
@ -345,8 +345,8 @@ fn ImportDirective(module_path: @DVec<Atom>,
/// The item that an import resolves to.
struct Target {
let target_module: @Module;
let bindings: @NameBindings;
target_module: @Module,
bindings: @NameBindings,
}
fn Target(target_module: @Module, bindings: @NameBindings) -> Target {
@ -357,19 +357,19 @@ fn Target(target_module: @Module, bindings: @NameBindings) -> Target {
}
struct ImportResolution {
let span: span;
span: span,
// The number of outstanding references to this name. When this reaches
// zero, outside modules can count on the targets being correct. Before
// 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>;
let mut value_target: Option<Target>;
let mut type_target: Option<Target>;
mut module_target: Option<Target>,
mut value_target: Option<Target>,
mut type_target: Option<Target>,
let mut used: bool;
mut used: bool,
fn target_for_namespace(namespace: Namespace) -> Option<Target> {
match namespace {
@ -400,11 +400,11 @@ enum ParentLink {
/// One node in the tree of modules.
struct Module {
let parent_link: ParentLink;
let mut def_id: Option<def_id>;
parent_link: ParentLink,
mut def_id: Option<def_id>,
let children: hashmap<Atom,@NameBindings>;
let imports: DVec<@ImportDirective>;
children: hashmap<Atom,@NameBindings>,
imports: DVec<@ImportDirective>,
// The anonymous children of this node. Anonymous children are pseudo-
// 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
// 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
// items, not names.
@ -429,16 +429,16 @@ struct Module {
// The atom is the name of the exported item, while the node ID is the
// 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.
let import_resolutions: hashmap<Atom,@ImportResolution>;
import_resolutions: hashmap<Atom,@ImportResolution>,
// 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.
let mut resolved_import_count: uint;
mut resolved_import_count: uint,
fn all_imports_resolved() -> bool {
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
// bound to.
struct NameBindings {
let mut module_def: ModuleDef; //< Meaning in module namespace.
let mut type_def: Option<Definition>; //< Meaning in type namespace.
let mut value_def: Option<Definition>; //< Meaning in value namespace.
mut module_def: ModuleDef, //< Meaning in module namespace.
mut type_def: Option<Definition>, //< Meaning in type namespace.
mut value_def: Option<Definition>, //< Meaning in value namespace.
// For error reporting
// XXX: Merge me into Definition.
let mut module_span: Option<span>;
let mut type_span: Option<span>;
let mut value_span: Option<span>;
mut module_span: Option<span>,
mut type_span: Option<span>,
mut value_span: Option<span>,
/// Creates a new module in this set of name bindings.
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.
struct PrimitiveTypeTable {
let primitive_types: hashmap<Atom,prim_ty>;
primitive_types: hashmap<Atom,prim_ty>,
fn intern(intr: ident_interner, string: @~str,
primitive_type: prim_ty) {
@ -710,55 +710,55 @@ fn Resolver(session: session, lang_items: LanguageItems,
/// The main resolver class.
struct Resolver {
let session: session;
let lang_items: LanguageItems;
let crate: @crate;
session: session,
lang_items: LanguageItems,
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,()>>;
let structs: hashmap<def_id,bool>;
trait_info: hashmap<def_id,@hashmap<Atom,()>>,
structs: hashmap<def_id,bool>,
// 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.
let mut current_module: @Module;
mut current_module: @Module,
// The current set of local scopes, for values.
// XXX: Reuse ribs to avoid allocation.
let value_ribs: @DVec<@Rib>;
value_ribs: @DVec<@Rib>,
// 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.
let label_ribs: @DVec<@Rib>;
label_ribs: @DVec<@Rib>,
// Whether the current context is an X-ray context. An X-ray context is
// 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.
let mut current_trait_refs: Option<@DVec<def_id>>;
mut current_trait_refs: Option<@DVec<def_id>>,
// The atom for the keyword "self".
let self_atom: Atom;
self_atom: Atom,
// The atoms for the primitive types.
let primitive_type_table: @PrimitiveTypeTable;
primitive_type_table: @PrimitiveTypeTable,
// The four namespaces.
let namespaces: ~[Namespace];
namespaces: ~[Namespace],
let def_map: DefMap;
let export_map: ExportMap;
let export_map2: ExportMap2;
let trait_map: TraitMap;
def_map: DefMap,
export_map: ExportMap,
export_map2: ExportMap2,
trait_map: TraitMap,
/// The main name resolution procedure.
fn resolve(@self, this: @Resolver) {

View File

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

View File

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

View File

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

View File

@ -121,11 +121,11 @@ fn method_to_MethodInfo(ast_method: @method) -> @MethodInfo {
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>>;
inherent_methods: hashmap<def_id,@DVec<@Impl>>,
// Contains implementations of methods associated with a trait. For these,
// 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 {
@ -146,18 +146,18 @@ fn CoherenceChecker(crate_context: @crate_ctxt) -> CoherenceChecker {
}
struct CoherenceChecker {
let crate_context: @crate_ctxt;
let inference_context: infer_ctxt;
crate_context: @crate_ctxt,
inference_context: infer_ctxt,
// A mapping from implementations to the corresponding base type
// 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
// 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
// method in every trait.

View File

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

View File

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

View File

@ -2,10 +2,10 @@ mod kitties {
struct cat {
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 {
priv {
let mut meows : uint;
mut meows : uint,
}
let how_hungry : int;
how_hungry : int,
fn speak() {}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,11 @@
// error-pattern:call to private method not allowed
struct cat {
priv {
let mut meows : uint;
mut meows : uint,
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
struct my_resource {
let x: int;
x: int,
drop { log(error, self.x); }
}

View File

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

View File

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

View File

@ -4,7 +4,7 @@
enum an_enum = &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 {
return e; //~ ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a`

View File

@ -1,15 +1,15 @@
struct yes0 {
let x: &uint;
x: &uint,
drop {}
}
struct yes1 {
let x: &self/uint;
x: &self/uint,
drop {}
}
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 {}
}

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@
// sent
struct foo {
let i: int;
let j: @~str;
i: int,
j: @~str,
}
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 {
let x:int;
x:int,
drop {
fn getbig(i: int) {
if i != 0 {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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