Skip to content

Commit d1e23ae

Browse files
committed
librustc: De-@mut MoveData
1 parent 1b06a95 commit d1e23ae

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use syntax::codemap::Span;
2323
use util::ppaux::{UserString};
2424

2525
pub fn gather_decl(bccx: &BorrowckCtxt,
26-
move_data: &mut MoveData,
26+
move_data: &MoveData,
2727
decl_id: ast::NodeId,
2828
_decl_span: Span,
2929
var_id: ast::NodeId) {
@@ -32,23 +32,23 @@ pub fn gather_decl(bccx: &BorrowckCtxt,
3232
}
3333

3434
pub fn gather_move_from_expr(bccx: &BorrowckCtxt,
35-
move_data: &mut MoveData,
35+
move_data: &MoveData,
3636
move_expr: @ast::Expr,
3737
cmt: mc::cmt) {
3838
gather_move_from_expr_or_pat(bccx, move_data, move_expr.id,
3939
MoveExpr(move_expr), cmt);
4040
}
4141

4242
pub fn gather_move_from_pat(bccx: &BorrowckCtxt,
43-
move_data: &mut MoveData,
43+
move_data: &MoveData,
4444
move_pat: @ast::Pat,
4545
cmt: mc::cmt) {
4646
gather_move_from_expr_or_pat(bccx, move_data, move_pat.id,
4747
MovePat(move_pat), cmt);
4848
}
4949

5050
fn gather_move_from_expr_or_pat(bccx: &BorrowckCtxt,
51-
move_data: &mut MoveData,
51+
move_data: &MoveData,
5252
move_id: ast::NodeId,
5353
move_kind: MoveKind,
5454
cmt: mc::cmt) {
@@ -67,7 +67,7 @@ fn gather_move_from_expr_or_pat(bccx: &BorrowckCtxt,
6767
}
6868

6969
pub fn gather_captures(bccx: &BorrowckCtxt,
70-
move_data: &mut MoveData,
70+
move_data: &MoveData,
7171
closure_expr: @ast::Expr) {
7272
let capture_map = bccx.capture_map.borrow();
7373
let captured_vars = capture_map.get().get(&closure_expr.id);
@@ -85,7 +85,7 @@ pub fn gather_captures(bccx: &BorrowckCtxt,
8585
}
8686

8787
pub fn gather_assignment(bccx: &BorrowckCtxt,
88-
move_data: &mut MoveData,
88+
move_data: &MoveData,
8989
assignment_id: ast::NodeId,
9090
assignment_span: Span,
9191
assignee_loan_path: @LoanPath,

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ mod gather_moves;
6767
struct GatherLoanCtxt<'a> {
6868
bccx: &'a BorrowckCtxt,
6969
id_range: id_range,
70-
move_data: @mut move_data::MoveData,
70+
move_data: @move_data::MoveData,
7171
all_loans: @mut ~[Loan],
7272
item_ub: ast::NodeId,
7373
repeating_ids: ~[ast::NodeId]
@@ -103,14 +103,14 @@ impl<'a> visit::Visitor<()> for GatherLoanCtxt<'a> {
103103
pub fn gather_loans(bccx: &BorrowckCtxt,
104104
decl: &ast::fn_decl,
105105
body: ast::P<ast::Block>)
106-
-> (id_range, @mut ~[Loan], @mut move_data::MoveData) {
106+
-> (id_range, @mut ~[Loan], @move_data::MoveData) {
107107
let mut glcx = GatherLoanCtxt {
108108
bccx: bccx,
109109
id_range: id_range::max(),
110110
all_loans: @mut ~[],
111111
item_ub: body.id,
112112
repeating_ids: ~[body.id],
113-
move_data: @mut MoveData::new()
113+
move_data: @MoveData::new()
114114
};
115115
glcx.gather_fn_arg_patterns(decl, body);
116116

src/librustc/middle/borrowck/move_data.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ pub struct MoveData {
5353
}
5454

5555
pub struct FlowedMoveData {
56-
move_data: @mut MoveData,
57-
// ^~~~~~~~~~~~~
58-
// It makes me sad to use @mut here, except that due to
59-
// the visitor design, this is what gather_loans
60-
// must produce.
56+
move_data: @MoveData,
57+
// ^~~~~~~~~
58+
// It makes me sad to use @ here, except that due to
59+
// the old visitor design, this is what gather_loans
60+
// used to have to produce, and this code hasn't been
61+
// updated.
6162

6263
dfcx_moves: MoveDataFlow,
6364

@@ -199,14 +200,14 @@ impl MoveData {
199200
paths.get()[*index].next_sibling
200201
}
201202

202-
fn set_path_first_move(&mut self,
203+
fn set_path_first_move(&self,
203204
index: MovePathIndex,
204205
first_move: MoveIndex) {
205206
let mut paths = self.paths.borrow_mut();
206207
paths.get()[*index].first_move = first_move
207208
}
208209

209-
fn set_path_first_child(&mut self,
210+
fn set_path_first_child(&self,
210211
index: MovePathIndex,
211212
first_child: MovePathIndex) {
212213
let mut paths = self.paths.borrow_mut();
@@ -225,7 +226,7 @@ impl MoveData {
225226
self.path_parent(index) == InvalidMovePathIndex
226227
}
227228

228-
pub fn move_path(&mut self,
229+
pub fn move_path(&self,
229230
tcx: ty::ctxt,
230231
lp: @LoanPath) -> MovePathIndex {
231232
/*!
@@ -344,7 +345,7 @@ impl MoveData {
344345

345346
}
346347

347-
pub fn add_move(&mut self,
348+
pub fn add_move(&self,
348349
tcx: ty::ctxt,
349350
lp: @LoanPath,
350351
id: ast::NodeId,
@@ -379,7 +380,7 @@ impl MoveData {
379380
}
380381
}
381382

382-
pub fn add_assignment(&mut self,
383+
pub fn add_assignment(&self,
383384
tcx: ty::ctxt,
384385
lp: @LoanPath,
385386
assign_id: ast::NodeId,
@@ -556,13 +557,12 @@ impl MoveData {
556557
}
557558

558559
impl FlowedMoveData {
559-
pub fn new(move_data: @mut MoveData,
560+
pub fn new(move_data: @MoveData,
560561
tcx: ty::ctxt,
561562
method_map: typeck::method_map,
562563
id_range: ast_util::id_range,
563564
body: &ast::Block)
564-
-> FlowedMoveData
565-
{
565+
-> FlowedMoveData {
566566
let mut dfcx_moves = {
567567
let moves = move_data.moves.borrow();
568568
DataFlowContext::new(tcx,

0 commit comments

Comments
 (0)