librustc: De-@mut MoveData

This commit is contained in:
Patrick Walton 2013-12-21 19:04:10 -08:00
parent 1b06a9593f
commit d1e23aeb0e
3 changed files with 22 additions and 22 deletions

View file

@ -23,7 +23,7 @@ use syntax::codemap::Span;
use util::ppaux::{UserString};
pub fn gather_decl(bccx: &BorrowckCtxt,
move_data: &mut MoveData,
move_data: &MoveData,
decl_id: ast::NodeId,
_decl_span: Span,
var_id: ast::NodeId) {
@ -32,7 +32,7 @@ pub fn gather_decl(bccx: &BorrowckCtxt,
}
pub fn gather_move_from_expr(bccx: &BorrowckCtxt,
move_data: &mut MoveData,
move_data: &MoveData,
move_expr: @ast::Expr,
cmt: mc::cmt) {
gather_move_from_expr_or_pat(bccx, move_data, move_expr.id,
@ -40,7 +40,7 @@ pub fn gather_move_from_expr(bccx: &BorrowckCtxt,
}
pub fn gather_move_from_pat(bccx: &BorrowckCtxt,
move_data: &mut MoveData,
move_data: &MoveData,
move_pat: @ast::Pat,
cmt: mc::cmt) {
gather_move_from_expr_or_pat(bccx, move_data, move_pat.id,
@ -48,7 +48,7 @@ pub fn gather_move_from_pat(bccx: &BorrowckCtxt,
}
fn gather_move_from_expr_or_pat(bccx: &BorrowckCtxt,
move_data: &mut MoveData,
move_data: &MoveData,
move_id: ast::NodeId,
move_kind: MoveKind,
cmt: mc::cmt) {
@ -67,7 +67,7 @@ fn gather_move_from_expr_or_pat(bccx: &BorrowckCtxt,
}
pub fn gather_captures(bccx: &BorrowckCtxt,
move_data: &mut MoveData,
move_data: &MoveData,
closure_expr: @ast::Expr) {
let capture_map = bccx.capture_map.borrow();
let captured_vars = capture_map.get().get(&closure_expr.id);
@ -85,7 +85,7 @@ pub fn gather_captures(bccx: &BorrowckCtxt,
}
pub fn gather_assignment(bccx: &BorrowckCtxt,
move_data: &mut MoveData,
move_data: &MoveData,
assignment_id: ast::NodeId,
assignment_span: Span,
assignee_loan_path: @LoanPath,

View file

@ -67,7 +67,7 @@ mod gather_moves;
struct GatherLoanCtxt<'a> {
bccx: &'a BorrowckCtxt,
id_range: id_range,
move_data: @mut move_data::MoveData,
move_data: @move_data::MoveData,
all_loans: @mut ~[Loan],
item_ub: ast::NodeId,
repeating_ids: ~[ast::NodeId]
@ -103,14 +103,14 @@ impl<'a> visit::Visitor<()> for GatherLoanCtxt<'a> {
pub fn gather_loans(bccx: &BorrowckCtxt,
decl: &ast::fn_decl,
body: ast::P<ast::Block>)
-> (id_range, @mut ~[Loan], @mut move_data::MoveData) {
-> (id_range, @mut ~[Loan], @move_data::MoveData) {
let mut glcx = GatherLoanCtxt {
bccx: bccx,
id_range: id_range::max(),
all_loans: @mut ~[],
item_ub: body.id,
repeating_ids: ~[body.id],
move_data: @mut MoveData::new()
move_data: @MoveData::new()
};
glcx.gather_fn_arg_patterns(decl, body);

View file

@ -53,11 +53,12 @@ pub struct MoveData {
}
pub struct FlowedMoveData {
move_data: @mut MoveData,
// ^~~~~~~~~~~~~
// It makes me sad to use @mut here, except that due to
// the visitor design, this is what gather_loans
// must produce.
move_data: @MoveData,
// ^~~~~~~~~
// It makes me sad to use @ here, except that due to
// the old visitor design, this is what gather_loans
// used to have to produce, and this code hasn't been
// updated.
dfcx_moves: MoveDataFlow,
@ -199,14 +200,14 @@ impl MoveData {
paths.get()[*index].next_sibling
}
fn set_path_first_move(&mut self,
fn set_path_first_move(&self,
index: MovePathIndex,
first_move: MoveIndex) {
let mut paths = self.paths.borrow_mut();
paths.get()[*index].first_move = first_move
}
fn set_path_first_child(&mut self,
fn set_path_first_child(&self,
index: MovePathIndex,
first_child: MovePathIndex) {
let mut paths = self.paths.borrow_mut();
@ -225,7 +226,7 @@ impl MoveData {
self.path_parent(index) == InvalidMovePathIndex
}
pub fn move_path(&mut self,
pub fn move_path(&self,
tcx: ty::ctxt,
lp: @LoanPath) -> MovePathIndex {
/*!
@ -344,7 +345,7 @@ impl MoveData {
}
pub fn add_move(&mut self,
pub fn add_move(&self,
tcx: ty::ctxt,
lp: @LoanPath,
id: ast::NodeId,
@ -379,7 +380,7 @@ impl MoveData {
}
}
pub fn add_assignment(&mut self,
pub fn add_assignment(&self,
tcx: ty::ctxt,
lp: @LoanPath,
assign_id: ast::NodeId,
@ -556,13 +557,12 @@ impl MoveData {
}
impl FlowedMoveData {
pub fn new(move_data: @mut MoveData,
pub fn new(move_data: @MoveData,
tcx: ty::ctxt,
method_map: typeck::method_map,
id_range: ast_util::id_range,
body: &ast::Block)
-> FlowedMoveData
{
-> FlowedMoveData {
let mut dfcx_moves = {
let moves = move_data.moves.borrow();
DataFlowContext::new(tcx,