Skip to content

Commit abbee6d

Browse files
committed
librustc: De-@mut ScopeInfo
1 parent 8728b09 commit abbee6d

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ pub fn have_cached_lpad(bcx: @Block) -> bool {
10051005
return res;
10061006
}
10071007

1008-
pub fn in_lpad_scope_cx(bcx: @Block, f: |si: &mut ScopeInfo|) {
1008+
pub fn in_lpad_scope_cx(bcx: @Block, f: |si: &ScopeInfo|) {
10091009
let mut bcx = bcx;
10101010
let mut cur_scope = bcx.scope.get();
10111011
loop {
@@ -1191,7 +1191,7 @@ pub fn trans_stmt(cx: @Block, s: &ast::Stmt) -> @Block {
11911191
// next three functions instead.
11921192
pub fn new_block(cx: @FunctionContext,
11931193
parent: Option<@Block>,
1194-
scope: Option<@mut ScopeInfo>,
1194+
scope: Option<@ScopeInfo>,
11951195
is_lpad: bool,
11961196
name: &str,
11971197
opt_node_info: Option<NodeInfo>)
@@ -1216,9 +1216,10 @@ pub fn new_block(cx: @FunctionContext,
12161216
}
12171217
}
12181218

1219-
pub fn simple_block_scope(parent: Option<@mut ScopeInfo>,
1220-
node_info: Option<NodeInfo>) -> @mut ScopeInfo {
1221-
@mut ScopeInfo {
1219+
pub fn simple_block_scope(parent: Option<@ScopeInfo>,
1220+
node_info: Option<NodeInfo>)
1221+
-> @ScopeInfo {
1222+
@ScopeInfo {
12221223
parent: parent,
12231224
loop_break: None,
12241225
loop_label: None,
@@ -1248,7 +1249,7 @@ pub fn loop_scope_block(bcx: @Block,
12481249
loop_label: Option<Name>,
12491250
n: &str,
12501251
opt_node_info: Option<NodeInfo>) -> @Block {
1251-
return new_block(bcx.fcx, Some(bcx), Some(@mut ScopeInfo {
1252+
return new_block(bcx.fcx, Some(bcx), Some(@ScopeInfo {
12521253
parent: None,
12531254
loop_break: Some(loop_break),
12541255
loop_label: loop_label,
@@ -1329,7 +1330,7 @@ pub fn cleanup_and_leave(bcx: @Block,
13291330
cur_scope = match cur_scope {
13301331
Some (inf) if !inf.empty_cleanups() => {
13311332
let (sub_cx, dest, inf_cleanups) = {
1332-
let inf = &mut *inf;
1333+
let inf = &*inf;
13331334
let mut skip = 0;
13341335
let mut dest = None;
13351336
{

src/librustc/middle/trans/common.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ pub struct cleanup_path {
430430
dest: BasicBlockRef
431431
}
432432

433-
pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) {
433+
pub fn shrink_scope_clean(scope_info: &ScopeInfo, size: uint) {
434434
scope_info.landing_pad.set(None);
435435
let new_cleanup_paths = {
436436
let cleanup_paths = scope_info.cleanup_paths.borrow();
@@ -443,7 +443,7 @@ pub fn shrink_scope_clean(scope_info: &mut ScopeInfo, size: uint) {
443443
scope_info.cleanup_paths.set(new_cleanup_paths)
444444
}
445445

446-
pub fn grow_scope_clean(scope_info: &mut ScopeInfo) {
446+
pub fn grow_scope_clean(scope_info: &ScopeInfo) {
447447
scope_info.landing_pad.set(None);
448448
}
449449

@@ -623,7 +623,7 @@ pub fn block_cleanups(bcx: &Block) -> ~[cleanup] {
623623
}
624624

625625
pub struct ScopeInfo {
626-
parent: Option<@mut ScopeInfo>,
626+
parent: Option<@ScopeInfo>,
627627
loop_break: Option<@Block>,
628628
loop_label: Option<Name>,
629629
// A list of functions that must be run at when leaving this
@@ -640,7 +640,7 @@ pub struct ScopeInfo {
640640
}
641641

642642
impl ScopeInfo {
643-
pub fn empty_cleanups(&mut self) -> bool {
643+
pub fn empty_cleanups(&self) -> bool {
644644
let cleanups = self.cleanups.borrow();
645645
cleanups.get().is_empty()
646646
}
@@ -694,7 +694,7 @@ pub struct Block {
694694
unreachable: Cell<bool>,
695695
parent: Option<@Block>,
696696
// The current scope within this basic block
697-
scope: RefCell<Option<@mut ScopeInfo>>,
697+
scope: RefCell<Option<@ScopeInfo>>,
698698
// Is this block part of a landing pad?
699699
is_lpad: bool,
700700
// info about the AST node this block originated from, if any
@@ -803,7 +803,7 @@ pub fn val_ty(v: ValueRef) -> Type {
803803

804804
pub fn in_scope_cx(cx: @Block,
805805
scope_id: Option<ast::NodeId>,
806-
f: |si: &mut ScopeInfo|) {
806+
f: |si: &ScopeInfo|) {
807807
let mut cur = cx;
808808
let mut cur_scope = cur.scope.get();
809809
loop {

0 commit comments

Comments
 (0)