Make moves explicit in rustc

This commit is contained in:
Tim Chevalier 2012-09-11 10:26:23 -07:00
parent 4a865401f5
commit 3aa5b0cb44
11 changed files with 23 additions and 23 deletions

View File

@ -125,7 +125,7 @@ fn time<T>(do_it: bool, what: ~str, thunk: fn() -> T) -> T {
let end = std::time::precise_time_s();
io::stdout().write_str(fmt!("time: %3.3f s\t%s\n",
end - start, what));
return rv;
move rv
}
enum compile_upto {

View File

@ -1103,7 +1103,7 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] {
diag: parms.diag,
tcx: parms.tcx,
buf: buf,
stats: stats,
stats: move stats,
reachable: parms.reachable,
reexports: parms.reexports,
reexports2: parms.reexports2,

View File

@ -400,7 +400,7 @@ fn save_and_restore<T:Copy,U>(&save_and_restore_t: T, f: fn() -> U) -> U {
let old_save_and_restore_t = save_and_restore_t;
let u <- f();
save_and_restore_t = old_save_and_restore_t;
return u;
move u
}
/// Creates and returns a new root_map

View File

@ -1466,7 +1466,7 @@ impl Liveness {
let r <- f();
self.break_ln = bl;
self.cont_ln = cl;
return r;
move r
}
}

View File

@ -728,7 +728,7 @@ fn Resolver(session: session, lang_items: LanguageItems,
intr: session.intr()
};
return self;
move self
}
/// The main resolver class.

View File

@ -256,27 +256,27 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
if cls[i] == sseup_class {
cls[i] = sse_int_class;
} else if is_sse(cls[i]) {
i += 1u;
i += 1;
while cls[i] == sseup_class { i += 1u; }
} else if cls[i] == x87_class {
i += 1u;
i += 1;
while cls[i] == x87up_class { i += 1u; }
} else {
i += 1u;
i += 1;
}
}
}
}
let words = (ty_size(ty) + 7u) / 8u;
let words = (ty_size(ty) + 7) / 8;
let cls = vec::to_mut(vec::from_elem(words, no_class));
if words > 4u {
if words > 4 {
all_mem(cls);
return vec::from_mut(cls);
return vec::from_mut(move cls);
}
classify(ty, cls, 0u, 0u);
classify(ty, cls, 0, 0);
fixup(ty, cls);
return vec::from_mut(cls);
return vec::from_mut(move cls);
}
fn llreg_ty(cls: ~[x86_64_reg_class]) -> TypeRef {

View File

@ -740,7 +740,7 @@ impl @fn_ctxt {
self.region_lb = lb;
let v <- f();
self.region_lb = old_region_lb;
return v;
move v
}
fn region_var_if_parameterized(rp: Option<ty::region_variance>,

View File

@ -92,18 +92,18 @@ impl @rcx {
}
fn regionck_expr(fcx: @fn_ctxt, e: @ast::expr) {
let rcx = rcx_({fcx:fcx, mut errors_reported: 0u});
let rcx = rcx_({fcx:fcx, mut errors_reported: 0});
let v = regionck_visitor();
v.visit_expr(e, @rcx, v);
v.visit_expr(e, @(move rcx), v);
fcx.infcx().resolve_regions();
}
fn regionck_fn(fcx: @fn_ctxt,
_decl: ast::fn_decl,
blk: ast::blk) {
let rcx = rcx_({fcx:fcx, mut errors_reported: 0u});
let rcx = rcx_({fcx:fcx, mut errors_reported: 0});
let v = regionck_visitor();
v.visit_block(blk, @rcx, v);
v.visit_block(blk, @(move rcx), v);
fcx.infcx().resolve_regions();
}

View File

@ -565,7 +565,7 @@ impl infer_ctxt {
self.ty_var_bindings.bindings = ~[];
self.int_var_bindings.bindings = ~[];
self.region_vars.commit();
r
move r
}
}
@ -579,7 +579,7 @@ impl infer_ctxt {
Ok(_) => (),
Err(_) => self.rollback_to(&snapshot)
}
r
move r
}
}
@ -590,7 +590,7 @@ impl infer_ctxt {
let snapshot = self.start_snapshot();
let r = self.try(f);
self.rollback_to(&snapshot);
r
move r
}
}
}

View File

@ -866,7 +866,7 @@ impl RegionVarBindings {
}
}
return graph;
return (move graph);
fn insert_edge(graph: &mut Graph,
node_id: RegionVid,

View File

@ -11,7 +11,7 @@ fn indent<R>(op: fn() -> R) -> R {
debug!(">>");
let r <- op();
debug!("<< (Result = %?)", r);
return r;
move r
}
struct _indenter {