Remove uses of mutable ref mode.
It's still in the compiler right now, but warned about
This commit is contained in:
parent
04497ea7b9
commit
45345bda6a
11 changed files with 73 additions and 44 deletions
|
|
@ -117,7 +117,7 @@ fn encode_mutability(ebml_w: ebml::Writer, mt: class_mutability) {
|
|||
type entry<T> = {val: T, pos: uint};
|
||||
|
||||
fn add_to_index(ecx: @encode_ctxt, ebml_w: ebml::Writer, path: &[ident],
|
||||
&index: ~[entry<~str>], name: ident) {
|
||||
index: &mut ~[entry<~str>], name: ident) {
|
||||
let mut full_path = ~[];
|
||||
full_path.push_all(path);
|
||||
full_path.push(name);
|
||||
|
|
|
|||
|
|
@ -396,10 +396,10 @@ type req_maps = {
|
|||
pure_map: HashMap<ast::node_id, bckerr>
|
||||
};
|
||||
|
||||
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;
|
||||
fn save_and_restore<T:Copy,U>(save_and_restore_t: &mut 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;
|
||||
*save_and_restore_t = old_save_and_restore_t;
|
||||
move u
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -542,9 +542,9 @@ fn check_loans_in_fn(fk: visit::fn_kind, decl: ast::fn_decl, body: ast::blk,
|
|||
visitor: visit::vt<check_loan_ctxt>) {
|
||||
|
||||
debug!("purity on entry=%?", copy self.declared_purity);
|
||||
do save_and_restore(self.in_ctor) {
|
||||
do save_and_restore(self.declared_purity) {
|
||||
do save_and_restore(self.fn_args) {
|
||||
do save_and_restore(&mut(self.in_ctor)) {
|
||||
do save_and_restore(&mut(self.declared_purity)) {
|
||||
do save_and_restore(&mut(self.fn_args)) {
|
||||
let is_stack_closure = self.is_stack_closure(id);
|
||||
let fty = ty::node_id_to_type(self.tcx(), id);
|
||||
self.declared_purity = ty::determine_inherited_purity(
|
||||
|
|
@ -667,7 +667,7 @@ fn check_loans_in_expr(expr: @ast::expr,
|
|||
fn check_loans_in_block(blk: ast::blk,
|
||||
&&self: check_loan_ctxt,
|
||||
vt: visit::vt<check_loan_ctxt>) {
|
||||
do save_and_restore(self.declared_purity) {
|
||||
do save_and_restore(&mut(self.declared_purity)) {
|
||||
self.check_for_conflicting_loans(blk.node.id);
|
||||
|
||||
match blk.node.rules {
|
||||
|
|
|
|||
|
|
@ -831,9 +831,9 @@ impl Liveness {
|
|||
let mut changed = false;
|
||||
do self.indices2(ln, succ_ln) |idx, succ_idx| {
|
||||
changed |= copy_if_invalid(copy self.users[succ_idx].reader,
|
||||
self.users[idx].reader);
|
||||
&mut self.users[idx].reader);
|
||||
changed |= copy_if_invalid(copy self.users[succ_idx].writer,
|
||||
self.users[idx].writer);
|
||||
&mut self.users[idx].writer);
|
||||
if self.users[succ_idx].used && !self.users[idx].used {
|
||||
self.users[idx].used = true;
|
||||
changed = true;
|
||||
|
|
@ -844,10 +844,10 @@ impl Liveness {
|
|||
ln.to_str(), self.ln_str(succ_ln), first_merge, changed);
|
||||
return changed;
|
||||
|
||||
fn copy_if_invalid(src: LiveNode, &dst: LiveNode) -> bool {
|
||||
fn copy_if_invalid(src: LiveNode, dst: &mut LiveNode) -> bool {
|
||||
if src.is_valid() {
|
||||
if !dst.is_valid() {
|
||||
dst = src;
|
||||
*dst = src;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use lib::llvm::ValueRef;
|
|||
use common::*;
|
||||
use build::*;
|
||||
use base::*;
|
||||
use shape::llsize_of;
|
||||
use datum::immediate_rvalue;
|
||||
|
||||
export make_free_glue, autoderef, duplicate;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue