librustc: Get rid of move.

This commit is contained in:
Luqman Aden 2013-02-15 04:14:34 -05:00 committed by Luqman Aden
parent e61b243edf
commit 99b3c07b4e
30 changed files with 85 additions and 85 deletions

View file

@ -156,7 +156,7 @@ pub mod jit {
code: entry,
env: ptr::null()
};
let func: fn(++argv: ~[~str]) = cast::transmute(move closure);
let func: fn(++argv: ~[~str]) = cast::transmute(closure);
func(~[/*bad*/copy sess.opts.binary]);
}
@ -559,11 +559,11 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
let {name: opt_name, vers: opt_vers,
cmh_items: cmh_items} = provided_link_metas(sess, c);
let name = crate_meta_name(sess, output, move opt_name);
let vers = crate_meta_vers(sess, move opt_vers);
let name = crate_meta_name(sess, output, opt_name);
let vers = crate_meta_vers(sess, opt_vers);
let dep_hashes = cstore::get_dep_hashes(sess.cstore);
let extras_hash =
crate_meta_extras_hash(symbol_hasher, move cmh_items,
crate_meta_extras_hash(symbol_hasher, cmh_items,
dep_hashes);
return {name: name, vers: vers, extras_hash: extras_hash};

View file

@ -172,7 +172,7 @@ pub 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));
move rv
rv
}
pub enum compile_upto {
@ -257,7 +257,7 @@ pub fn compile_upto(sess: Session, cfg: ast::crate_cfg,
let (llmod, link_meta) = {
let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
region_map, rp_set, move lang_items, crate);
region_map, rp_set, lang_items, crate);
let (method_map, vtable_map) =
time(time_passes, ~"typechecking", ||

View file

@ -1481,7 +1481,7 @@ pub fn struct_element_types(struct_ty: TypeRef) -> ~[TypeRef] {
llvm::LLVMGetStructElementTypes(
struct_ty, ptr::to_mut_unsafe_ptr(&mut buf[0]));
}
return move buf;
return buf;
}
}

View file

@ -752,10 +752,10 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
def_id: did
};
vec::push(&mut result, move provided_trait_method_info);
vec::push(&mut result, provided_trait_method_info);
}
return move result;
return result;
}
/// Returns the supertraits of the given trait.
@ -766,7 +766,7 @@ pub fn get_supertraits(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
for reader::tagged_docs(item_doc, tag_impl_trait) |trait_doc| {
results.push(doc_type(trait_doc, tcx, cdata));
}
return dvec::unwrap(move results);
return dvec::unwrap(results);
}
// If the item in question is a trait, returns its set of methods and
@ -847,7 +847,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
}
}
return Some(dvec::unwrap(move static_impl_methods));
return Some(dvec::unwrap(static_impl_methods));
}
pub fn get_item_attrs(cdata: cmd,

View file

@ -228,7 +228,7 @@ fn get_metadata_section(os: os,
csz - vlen);
do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| {
let inflated = flate::inflate_bytes(bytes);
found = move Some(@(move inflated));
found = Some(@(inflated));
}
if found != None {
return found;

View file

@ -1140,7 +1140,7 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
let ids = val_dsr.read_to_vec(|| {
xcx.tr_id(val_dsr.read_int())
});
let dvec = @dvec::from_vec(move ids);
let dvec = @dvec::from_vec(ids);
dcx.maps.last_use_map.insert(id, dvec);
} else if tag == (c::tag_table_method_map as uint) {
dcx.maps.method_map.insert(

View file

@ -632,7 +632,7 @@ fn check_loans_in_fn(fk: visit::fn_kind,
_ => {} // Ignore this argument.
}
}
*self.fn_args = @move fn_args;
*self.fn_args = @fn_args;
}
}

View file

@ -376,8 +376,8 @@ impl GatherLoanCtxt {
Some(_) => {
match loan::loan(self.bccx, cmt, scope_r, loan_kind) {
Err(ref e) => { self.bccx.report((*e)); }
Ok(move loans) => {
self.add_loans(cmt, loan_kind, scope_r, move loans);
Ok(loans) => {
self.add_loans(cmt, loan_kind, scope_r, loans);
}
}
}
@ -540,7 +540,7 @@ impl GatherLoanCtxt {
}
};
self.add_loans_to_scope_id(scope_id, move loans);
self.add_loans_to_scope_id(scope_id, loans);
if loan_kind.is_freeze() && !cmt.mutbl.is_immutable() {
self.bccx.stats.loaned_paths_imm += 1;
@ -566,7 +566,7 @@ impl GatherLoanCtxt {
req_loans.push_all(loans);
}
None => {
let dvec = @dvec::from_vec(move loans);
let dvec = @dvec::from_vec(loans);
let req_loan_map = self.req_maps.req_loan_map;
req_loan_map.insert(scope_id, dvec);
}

View file

@ -420,7 +420,7 @@ pub fn save_and_restore<T:Copy,U>(save_and_restore_t: &mut T,
let old_save_and_restore_t = *save_and_restore_t;
let u = f();
*save_and_restore_t = old_save_and_restore_t;
move u
u
}
pub fn save_and_restore_managed<T:Copy,U>(save_and_restore_t: @mut T,
@ -428,7 +428,7 @@ pub fn save_and_restore_managed<T:Copy,U>(save_and_restore_t: @mut T,
let old_save_and_restore_t = *save_and_restore_t;
let u = f();
*save_and_restore_t = old_save_and_restore_t;
move u
u
}
impl LoanKind {

View file

@ -1520,7 +1520,7 @@ impl Liveness {
self.cont_ln.insert(loop_node_id, cont_ln);
let r = f();
self.loop_scope.pop();
move r
r
}
}

View file

@ -797,7 +797,7 @@ pub fn Resolver(session: Session,
intr: session.intr()
};
move self
self
}
/// The main resolver class.
@ -3255,7 +3255,7 @@ pub impl Resolver {
self.add_exports_for_module(&mut exports2, module_);
match copy module_.def_id {
Some(def_id) => {
self.export_map2.insert(def_id.node, move exports2);
self.export_map2.insert(def_id.node, exports2);
debug!("(computing exports) writing exports for %d (some)",
def_id.node);
}

View file

@ -559,7 +559,7 @@ pub fn enter_opt(bcx: block, m: &[@Match/&r], opt: &Opt, col: uint,
Some(fp) => reordered_patterns.push(fp.pat)
}
}
Some(dvec::unwrap(move reordered_patterns))
Some(dvec::unwrap(reordered_patterns))
} else {
None
}
@ -815,7 +815,7 @@ pub fn get_options(ccx: @crate_ctxt, m: &[@Match], col: uint) -> ~[Opt] {
_ => {}
}
}
return dvec::unwrap(move found);
return dvec::unwrap(found);
}
pub fn extract_variant_args(bcx: block,
@ -1657,7 +1657,7 @@ pub fn trans_match_inner(scope_cx: block,
arm_cxs.push(bcx);
}
bcx = controlflow::join_blocks(scope_cx, dvec::unwrap(move arm_cxs));
bcx = controlflow::join_blocks(scope_cx, dvec::unwrap(arm_cxs));
return bcx;
fn mk_fail(bcx: block, sp: span, +msg: ~str,

View file

@ -1174,7 +1174,7 @@ pub fn new_block(cx: fn_ctxt, parent: Option<block>, +kind: block_kind,
});
let bcx = mk_block(llbb,
parent,
move kind,
kind,
is_lpad,
opt_node_info,
cx);

View file

@ -274,11 +274,11 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
if words > 4 {
all_mem(cls);
let cls = cls;
return move cls;
return cls;
}
classify(ty, cls, 0, 0);
fixup(ty, cls);
return move cls;
return cls;
}
fn llreg_ty(cls: &[x86_64_reg_class]) -> TypeRef {

View file

@ -593,7 +593,7 @@ pub fn block_(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,
terminated: false,
unreachable: false,
parent: parent,
kind: move kind,
kind: kind,
is_lpad: is_lpad,
node_info: node_info,
fcx: fcx
@ -607,7 +607,7 @@ pub enum block = @block_;
pub fn mk_block(llbb: BasicBlockRef, parent: Option<block>, -kind: block_kind,
is_lpad: bool, node_info: Option<node_info>, fcx: fn_ctxt)
-> block {
block(@block_(llbb, parent, move kind, is_lpad, node_info, fcx))
block(@block_(llbb, parent, kind, is_lpad, node_info, fcx))
}
// First two args are retptr, env

View file

@ -152,7 +152,7 @@ enum debug_metadata {
fn cast_safely<T: Copy, U>(val: T) -> U {
unsafe {
let val2 = val;
return cast::transmute(move val2);
return cast::transmute(val2);
}
}

View file

@ -320,7 +320,7 @@ pub pure fn get(t: t) -> t_box {
unsafe {
let t2 = cast::reinterpret_cast::<t, t_box>(&t);
let t3 = t2;
cast::forget(move t2);
cast::forget(t2);
t3
}
}
@ -830,7 +830,7 @@ pub fn mk_ctxt(s: session::Session,
inferred_modes: HashMap(),
adjustments: HashMap(),
normalized_cache: new_ty_hash(),
lang_items: move lang_items,
lang_items: lang_items,
legacy_boxed_traits: HashMap(),
provided_methods: HashMap(),
provided_method_sources: HashMap(),
@ -909,10 +909,10 @@ fn mk_t_with_id(cx: ctxt, +st: sty, o_def_id: Option<ast::def_id>) -> t {
}
}
let t = @{sty: move st, id: cx.next_id, flags: flags, o_def_id: o_def_id};
let t = @{sty: st, id: cx.next_id, flags: flags, o_def_id: o_def_id};
let key = intern_key {sty: to_unsafe_ptr(&t.sty), o_def_id: o_def_id};
cx.interner.insert(move key, t);
cx.interner.insert(key, t);
cx.next_id += 1u;
unsafe { cast::reinterpret_cast(&t) }
@ -1178,7 +1178,7 @@ pub fn fold_sig(sig: &FnSig, fldop: fn(t) -> t) -> FnSig {
};
FnSig {
inputs: move args,
inputs: args,
output: fldop(sig.output)
}
}
@ -3110,7 +3110,7 @@ pub fn expr_kind(tcx: ctxt,
ast::def_local(*) |
ast::def_self(*) => LvalueExpr,
move def => {
def => {
tcx.sess.span_bug(expr.span, fmt!(
"Uncategorized def for expr %?: %?",
expr.id, def));
@ -3617,7 +3617,7 @@ pub fn trait_supertraits(cx: ctxt,
}
// Unwrap and return the result.
return @dvec::unwrap(move result);
return @dvec::unwrap(result);
}
pub fn trait_methods(cx: ctxt, id: ast::def_id) -> @~[method] {

View file

@ -139,7 +139,7 @@ pub fn lookup(
let mme = lcx.do_lookup(self_ty);
debug!("method lookup for %s yielded %?",
expr_repr(fcx.tcx(), expr), mme);
return move mme;
return mme;
}
pub struct LookupContext {
@ -204,26 +204,26 @@ pub impl LookupContext {
check::DontDerefArgs => {
match self.search_for_autoderefd_method(self_ty,
autoderefs) {
Some(move mme) => { return Some(mme); }
Some(mme) => { return Some(mme); }
None => {}
}
match self.search_for_autoptrd_method(self_ty,
autoderefs) {
Some(move mme) => { return Some(move mme); }
Some(mme) => { return Some(mme); }
None => {}
}
}
check::DoDerefArgs => {
match self.search_for_autoptrd_method(self_ty,
autoderefs) {
Some(move mme) => { return Some(move mme); }
Some(mme) => { return Some(mme); }
None => {}
}
match self.search_for_autoderefd_method(self_ty,
autoderefs) {
Some(move mme) => { return Some(mme); }
Some(mme) => { return Some(mme); }
None => {}
}
}
@ -457,7 +457,7 @@ pub impl LookupContext {
self.create_rcvr_ty_and_substs_for_method(
method.self_ty,
rcvr_ty,
move init_substs,
init_substs,
TransformTypeNormally);
let cand = Candidate {
@ -525,12 +525,12 @@ pub impl LookupContext {
let (rcvr_ty, rcvr_substs) =
self.create_rcvr_ty_and_substs_for_method(method.self_ty,
self_ty,
move rcvr_substs,
rcvr_substs,
TransformTypeForObject);
self.inherent_candidates.push(Candidate {
rcvr_ty: rcvr_ty,
rcvr_substs: move rcvr_substs,
rcvr_substs: rcvr_substs,
explicit_self: method.self_ty,
num_method_tps: method.tps.len(),
self_mode: get_mode_from_self_type(method.self_ty),
@ -585,7 +585,7 @@ pub impl LookupContext {
self.create_rcvr_ty_and_substs_for_method(
method_self_ty,
self_ty,
move rcvr_substs,
rcvr_substs,
TransformTypeNormally);
let origin = if trait_did == did {
method_self(trait_did, index)
@ -595,7 +595,7 @@ pub impl LookupContext {
};
self.inherent_candidates.push(Candidate {
rcvr_ty: rcvr_ty,
rcvr_substs: move rcvr_substs,
rcvr_substs: rcvr_substs,
explicit_self: method_self_ty,
num_method_tps: method_num_tps,
self_mode: get_mode_from_self_type(method_self_ty),
@ -648,12 +648,12 @@ pub impl LookupContext {
self.create_rcvr_ty_and_substs_for_method(
method.self_type,
impl_ty,
move impl_substs,
impl_substs,
TransformTypeNormally);
candidates.push(Candidate {
rcvr_ty: impl_ty,
rcvr_substs: move impl_substs,
rcvr_substs: impl_substs,
explicit_self: method.self_type,
num_method_tps: method.n_tps,
self_mode: get_mode_from_self_type(method.self_type),
@ -693,7 +693,7 @@ pub impl LookupContext {
candidates.push(Candidate {
rcvr_ty: impl_ty,
rcvr_substs: move impl_substs,
rcvr_substs: impl_substs,
explicit_self: provided_method_info.method_info.self_type,
num_method_tps: provided_method_info.method_info.n_tps,
self_mode: get_mode_from_self_type(
@ -722,10 +722,10 @@ pub impl LookupContext {
match self_decl {
sty_static | sty_value | sty_by_ref |
sty_box(_) | sty_uniq(_) => {
move self_substs
self_substs
}
sty_region(_) if self_substs.self_r.is_some() => {
move self_substs
self_substs
}
sty_region(_) => {
substs {
@ -761,7 +761,7 @@ pub impl LookupContext {
self.consider_reborrow(self_ty, autoderefs);
match self.search_for_method(self_ty) {
None => None,
Some(move mme) => {
Some(mme) => {
debug!("(searching for autoderef'd method) writing \
adjustment (%u) to %d",
autoderefs,
@ -945,7 +945,7 @@ pub impl LookupContext {
let autoref_ty = mk_autoref_ty(*mutbl, region);
match self.search_for_method(autoref_ty) {
None => {}
Some(move mme) => {
Some(mme) => {
self.fcx.write_adjustment(
self.self_expr.id,
@ty::AutoAdjustment {
@ -977,8 +977,8 @@ pub impl LookupContext {
debug!("searching inherent candidates");
match self.consider_candidates(self_ty, &self.inherent_candidates) {
None => {}
Some(move mme) => {
return Some(move mme);
Some(mme) => {
return Some(mme);
}
}
@ -987,8 +987,8 @@ pub impl LookupContext {
None => {
return None;
}
Some(move mme) => {
return Some(move mme);
Some(mme) => {
return Some(mme);
}
}
}

View file

@ -870,7 +870,7 @@ pub impl FnCtxt {
self.region_lb = lb;
let v = f();
self.region_lb = old_region_lb;
move v
v
}
fn region_var_if_parameterized(@mut self,

View file

@ -553,7 +553,7 @@ pub impl CoherenceChecker {
UniversalQuantificationResult {
monotype: monotype,
type_variables: move type_parameters,
type_variables: type_parameters,
bounds: polytype.bounds
}
}

View file

@ -320,7 +320,7 @@ pub fn ensure_supertraits(ccx: @mut CrateCtxt,
instantiated.push(InstantiatedTraitRef { def_id: did, tpt: tpt });
}
tcx.supertraits.insert(local_def(id),
@dvec::unwrap(move instantiated));
@dvec::unwrap(instantiated));
}
/**

View file

@ -121,9 +121,9 @@ pub struct CombineFields {
pub fn expected_found<C:Combine,T>(
self: &C, +a: T, +b: T) -> ty::expected_found<T> {
if self.a_is_expected() {
ty::expected_found {expected: move a, found: move b}
ty::expected_found {expected: a, found: b}
} else {
ty::expected_found {expected: move b, found: move a}
ty::expected_found {expected: b, found: a}
}
}

View file

@ -186,7 +186,7 @@ pub impl Glb: Combine {
new_vars, a_isr, a_vars, b_vars,
r));
debug!("sig1 = %s", sig1.inf_str(self.infcx));
return Ok(move sig1);
return Ok(sig1);
fn generalize_region(self: &Glb,
snapshot: uint,

View file

@ -144,7 +144,7 @@ pub impl Lub: Combine {
&sig0,
|r, _in_fn| generalize_region(&self, snapshot, new_vars,
a_isr, r));
return Ok(move sig1);
return Ok(sig1);
fn generalize_region(self: &Lub,
snapshot: uint,

View file

@ -13,8 +13,8 @@
macro_rules! if_ok(
($inp: expr) => (
match $inp {
Ok(move v) => { move v }
Err(move e) => { return Err(e); }
Ok(v) => { v }
Err(e) => { return Err(e); }
}
)
);

View file

@ -599,7 +599,7 @@ impl @mut InferCtxt {
self.ty_var_bindings.bindings.truncate(0);
self.int_var_bindings.bindings.truncate(0);
self.region_vars.commit();
move r
r
}
}
@ -613,7 +613,7 @@ impl @mut InferCtxt {
Ok(_) => (),
Err(_) => self.rollback_to(&snapshot)
}
move r
r
}
}
@ -624,7 +624,7 @@ impl @mut InferCtxt {
let snapshot = self.start_snapshot();
let r = self.try(f);
self.rollback_to(&snapshot);
move r
r
}
}
}

View file

@ -899,7 +899,7 @@ pub impl RegionVarBindings {
// replace the NoValue entry with ErrorValue.
let mut values = self.values.take();
values[*rid] = ErrorValue;
self.values.put_back(move values);
self.values.put_back(values);
re_static
}
@ -999,9 +999,9 @@ pub impl RegionVarBindings {
None => {}
Some((ref r1, ref r2)) => {
result_set =
consider_adding_edge(move result_set, &r, r1, r2);
consider_adding_edge(result_set, &r, r1, r2);
result_set =
consider_adding_edge(move result_set, &r, r2, r1);
consider_adding_edge(result_set, &r, r2, r1);
}
}
@ -1018,13 +1018,13 @@ pub impl RegionVarBindings {
r1: &Region,
r2: &Region) -> ~[Region]
{
let mut result_set = move result_set;
let mut result_set = result_set;
if *r == *r1 { // Clearly, this is potentially inefficient.
if !result_set.contains(r2) {
result_set.push(*r2);
}
}
return move result_set;
return result_set;
}
}
@ -1254,8 +1254,8 @@ impl RegionVarBindings {
}
let mut graph = Graph {
nodes: move nodes,
edges: move edges
nodes: nodes,
edges: edges
};
for uint::range(0, num_edges) |edge_idx| {
@ -1273,7 +1273,7 @@ impl RegionVarBindings {
}
}
return (move graph);
return (graph);
fn insert_edge(+graph: &mut Graph,
node_id: RegionVid,

View file

@ -69,7 +69,7 @@ fn setup_env(test_name: &str, source_string: &str) -> Env {
cfg, parse_sess);
let tcx = ty::mk_ctxt(sess, dm, amap, freevars, region_map,
region_paramd_items, move lang_items, crate);
region_paramd_items, lang_items, crate);
let infcx = infer::new_infer_ctxt(tcx);
@ -192,7 +192,7 @@ impl Env {
onceness: ast::Many,
region: ty::re_static,
bounds: @~[]},
sig: FnSig {inputs: move inputs,
sig: FnSig {inputs: inputs,
output: output_ty}
})
}

View file

@ -326,7 +326,7 @@ pub fn monitor(+f: fn~(diagnostic::Emitter)) {
let (p, ch) = stream();
let ch = SharedChan(ch);
let ch_capture = ch.clone();
match do task::try |move f| {
match do task::try || {
let ch = ch_capture.clone();
let ch_capture = ch.clone();
// The 'diagnostics emitter'. Every error, warning, etc. should
@ -375,7 +375,7 @@ pub fn monitor(+f: fn~(diagnostic::Emitter)) {
pub fn main() {
let args = os::args();
do monitor |move args, demitter| {
do monitor |demitter| {
run_compiler(&args, demitter);
}
}

View file

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