Skip to content

Commit 9c71249

Browse files
committed
librustc: De-mut trans. rs=demuting
1 parent 553c27c commit 9c71249

File tree

6 files changed

+43
-43
lines changed

6 files changed

+43
-43
lines changed

src/librustc/middle/trans/_match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ pub fn extract_variant_args(bcx: block,
831831
-> ExtractedBlock {
832832
let (enm, evar) = vdefs;
833833
let _icx = bcx.insn_ctxt("match::extract_variant_args");
834-
let ccx = bcx.fcx.ccx;
834+
let ccx = *bcx.fcx.ccx;
835835
let enum_ty_substs = match ty::get(node_id_type(bcx, pat_id)).sty {
836836
ty::ty_enum(id, ref substs) => {
837837
assert id == enm;
@@ -1272,7 +1272,7 @@ pub fn compile_submatch(bcx: block,
12721272
12731273
let vals_left = vec::append(vec::slice(vals, 0u, col).to_vec(),
12741274
vec::slice(vals, col + 1u, vals.len()));
1275-
let ccx = bcx.fcx.ccx;
1275+
let ccx = *bcx.fcx.ccx;
12761276
let mut pat_id = 0;
12771277
for vec::each(m) |br| {
12781278
// Find a real id (we're adding placeholder wildcard patterns, but
@@ -1710,7 +1710,7 @@ pub fn bind_irrefutable_pat(bcx: block,
17101710
binding_mode: IrrefutablePatternBindingMode)
17111711
-> block {
17121712
let _icx = bcx.insn_ctxt("match::bind_irrefutable_pat");
1713-
let ccx = bcx.fcx.ccx;
1713+
let ccx = *bcx.fcx.ccx;
17141714
let mut bcx = bcx;
17151715

17161716
// Necessary since bind_irrefutable_pat is called outside trans_match

src/librustc/middle/trans/base.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
11621162
}
11631163
}
11641164
}
1165-
ast::decl_item(i) => trans_item(cx.fcx.ccx, *i)
1165+
ast::decl_item(i) => trans_item(*cx.fcx.ccx, *i)
11661166
}
11671167
}
11681168
ast::stmt_mac(*) => cx.tcx().sess.bug(~"unexpanded macro")
@@ -1584,25 +1584,25 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
15841584
param_substs: Option<@param_substs>,
15851585
sp: Option<span>) -> fn_ctxt {
15861586
let llbbs = mk_standard_basic_blocks(llfndecl);
1587-
return @fn_ctxt_ {
1587+
return @mut fn_ctxt_ {
15881588
llfn: llfndecl,
15891589
llenv: unsafe { llvm::LLVMGetParam(llfndecl, 1u as c_uint) },
15901590
llretptr: unsafe { llvm::LLVMGetParam(llfndecl, 0u as c_uint) },
1591-
mut llstaticallocas: llbbs.sa,
1592-
mut llloadenv: None,
1593-
mut llreturn: llbbs.rt,
1594-
mut llself: None,
1595-
mut personality: None,
1596-
mut loop_ret: None,
1597-
llargs: HashMap(),
1598-
lllocals: HashMap(),
1599-
llupvars: HashMap(),
1591+
llstaticallocas: llbbs.sa,
1592+
llloadenv: None,
1593+
llreturn: llbbs.rt,
1594+
llself: None,
1595+
personality: None,
1596+
loop_ret: None,
1597+
llargs: @HashMap(),
1598+
lllocals: @HashMap(),
1599+
llupvars: @HashMap(),
16001600
id: id,
16011601
impl_id: impl_id,
16021602
param_substs: param_substs,
16031603
span: sp,
16041604
path: path,
1605-
ccx: ccx
1605+
ccx: @ccx
16061606
};
16071607
}
16081608
@@ -1792,7 +1792,7 @@ pub fn trans_closure(ccx: @CrateContext,
17921792
llvm::LLVMSetGC(fcx.llfn, strategy);
17931793
}
17941794
}
1795-
ccx.uses_gc = true;
1795+
*ccx.uses_gc = true;
17961796
}
17971797

17981798
// Create the first basic block in the function and keep a handle on it to
@@ -2815,7 +2815,7 @@ pub fn trap(bcx: block) {
28152815
}
28162816
28172817
pub fn decl_gc_metadata(ccx: @CrateContext, llmod_id: ~str) {
2818-
if !ccx.sess.opts.gc || !ccx.uses_gc {
2818+
if !ccx.sess.opts.gc || !*ccx.uses_gc {
28192819
return;
28202820
}
28212821
@@ -3050,7 +3050,7 @@ pub fn trans_crate(sess: session::Session,
30503050
discrims: HashMap(),
30513051
discrim_symbols: HashMap(),
30523052
tydescs: ty::new_ty_hash(),
3053-
mut finished_tydescs: false,
3053+
finished_tydescs: @mut false,
30543054
external: HashMap(),
30553055
monomorphized: HashMap(),
30563056
monomorphizing: HashMap(),
@@ -3092,9 +3092,9 @@ pub fn trans_crate(sess: session::Session,
30923092
builder: BuilderRef_res(unsafe { llvm::LLVMCreateBuilder() }),
30933093
shape_cx: mk_ctxt(llmod),
30943094
crate_map: crate_map,
3095-
mut uses_gc: false,
3095+
uses_gc: @mut false,
30963096
dbg_cx: dbg_cx,
3097-
mut do_not_commit_warning_issued: false
3097+
do_not_commit_warning_issued: @mut false
30983098
};
30993099
31003100
{

src/librustc/middle/trans/common.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ pub struct CrateContext {
175175
tydescs: HashMap<ty::t, @mut tydesc_info>,
176176
// Set when running emit_tydescs to enforce that no more tydescs are
177177
// created.
178-
mut finished_tydescs: bool,
178+
finished_tydescs: @mut bool,
179179
// Track mapping of external ids to local items imported for inlining
180180
external: HashMap<ast::def_id, Option<ast::node_id>>,
181181
// Cache instances of monomorphized functions
@@ -224,9 +224,9 @@ pub struct CrateContext {
224224
// Set when at least one function uses GC. Needed so that
225225
// decl_gc_metadata knows whether to link to the module metadata, which
226226
// is not emitted by LLVM's GC pass when no functions use GC.
227-
mut uses_gc: bool,
227+
uses_gc: @mut bool,
228228
dbg_cx: Option<debuginfo::DebugContext>,
229-
mut do_not_commit_warning_issued: bool
229+
do_not_commit_warning_issued: @mut bool
230230
}
231231

232232
// Types used for llself.
@@ -273,34 +273,34 @@ pub struct fn_ctxt_ {
273273
// the function, due to LLVM's quirks.
274274
// A block for all the function's static allocas, so that LLVM
275275
// will coalesce them into a single alloca call.
276-
mut llstaticallocas: BasicBlockRef,
276+
llstaticallocas: BasicBlockRef,
277277
// A block containing code that copies incoming arguments to space
278278
// already allocated by code in one of the llallocas blocks.
279279
// (LLVM requires that arguments be copied to local allocas before
280280
// allowing most any operation to be performed on them.)
281-
mut llloadenv: Option<BasicBlockRef>,
282-
mut llreturn: BasicBlockRef,
281+
llloadenv: Option<BasicBlockRef>,
282+
llreturn: BasicBlockRef,
283283
// The 'self' value currently in use in this function, if there
284284
// is one.
285285
//
286286
// NB: This is the type of the self *variable*, not the self *type*. The
287287
// self type is set only for default methods, while the self variable is
288288
// set for all methods.
289-
mut llself: Option<ValSelfData>,
289+
llself: Option<ValSelfData>,
290290
// The a value alloca'd for calls to upcalls.rust_personality. Used when
291291
// outputting the resume instruction.
292-
mut personality: Option<ValueRef>,
292+
personality: Option<ValueRef>,
293293
// If this is a for-loop body that returns, this holds the pointers needed
294294
// for that (flagptr, retptr)
295-
mut loop_ret: Option<(ValueRef, ValueRef)>,
295+
loop_ret: Option<(ValueRef, ValueRef)>,
296296

297297
// Maps arguments to allocas created for them in llallocas.
298-
llargs: HashMap<ast::node_id, local_val>,
298+
llargs: @HashMap<ast::node_id, local_val>,
299299
// Maps the def_ids for local variables to the allocas created for
300300
// them in llallocas.
301-
lllocals: HashMap<ast::node_id, local_val>,
301+
lllocals: @HashMap<ast::node_id, local_val>,
302302
// Same as above, but for closure upvars
303-
llupvars: HashMap<ast::node_id, ValueRef>,
303+
llupvars: @HashMap<ast::node_id, ValueRef>,
304304

305305
// The node_id of the function, or -1 if it doesn't correspond to
306306
// a user-defined function.
@@ -319,14 +319,14 @@ pub struct fn_ctxt_ {
319319
path: path,
320320

321321
// This function's enclosing crate context.
322-
ccx: @CrateContext
322+
ccx: @@CrateContext
323323
}
324324

325-
pub type fn_ctxt = @fn_ctxt_;
325+
pub type fn_ctxt = @mut fn_ctxt_;
326326

327327
pub fn warn_not_to_commit(ccx: @CrateContext, msg: ~str) {
328-
if !ccx.do_not_commit_warning_issued {
329-
ccx.do_not_commit_warning_issued = true;
328+
if !*ccx.do_not_commit_warning_issued {
329+
*ccx.do_not_commit_warning_issued = true;
330330
ccx.sess.warn(msg + ~" -- do not commit like this!");
331331
}
332332
}
@@ -689,7 +689,7 @@ pub fn block_parent(cx: block) -> block {
689689
// Accessors
690690

691691
pub impl block {
692-
pure fn ccx() -> @CrateContext { self.fcx.ccx }
692+
pure fn ccx() -> @CrateContext { *self.fcx.ccx }
693693
pure fn tcx() -> ty::ctxt { self.fcx.ccx.tcx }
694694
pure fn sess() -> Session { self.fcx.ccx.sess }
695695

src/librustc/middle/trans/debuginfo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ pub fn create_local_var(bcx: block, local: @ast::local)
778778
pub fn create_arg(bcx: block, arg: ast::arg, sp: span)
779779
-> Option<@Metadata<ArgumentMetadata>> {
780780
unsafe {
781-
let fcx = bcx.fcx, cx = fcx.ccx;
781+
let fcx = bcx.fcx, cx = *fcx.ccx;
782782
let cache = get_cache(cx);
783783
let tg = ArgVariableTag;
784784
match cached_metadata::<@Metadata<ArgumentMetadata>>(
@@ -845,7 +845,7 @@ pub fn update_source_pos(cx: block, s: span) {
845845
}
846846
847847
pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
848-
let cx = fcx.ccx;
848+
let cx = *fcx.ccx;
849849
let dbg_cx = (/*bad*/copy cx.dbg_cx).get();
850850
851851
debug!("~~");

src/librustc/middle/trans/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,10 +944,10 @@ pub fn trans_local_var(bcx: block, def: ast::def) -> Datum {
944944
}
945945
}
946946
ast::def_arg(nid, _, _) => {
947-
take_local(bcx, bcx.fcx.llargs, nid)
947+
take_local(bcx, *bcx.fcx.llargs, nid)
948948
}
949949
ast::def_local(nid, _) | ast::def_binding(nid, _) => {
950-
take_local(bcx, bcx.fcx.lllocals, nid)
950+
take_local(bcx, *bcx.fcx.lllocals, nid)
951951
}
952952
ast::def_self(nid, _) => {
953953
let self_info: ValSelfData = match bcx.fcx.llself {

src/librustc/middle/trans/glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
654654
let _icx = ccx.insn_ctxt("declare_tydesc");
655655
// If emit_tydescs already ran, then we shouldn't be creating any new
656656
// tydescs.
657-
assert !ccx.finished_tydescs;
657+
assert !*ccx.finished_tydescs;
658658

659659
let llty = type_of(ccx, t);
660660

@@ -761,7 +761,7 @@ pub fn make_generic_glue(ccx: @CrateContext, t: ty::t, llfn: ValueRef,
761761
pub fn emit_tydescs(ccx: @CrateContext) {
762762
let _icx = ccx.insn_ctxt("emit_tydescs");
763763
// As of this point, allow no more tydescs to be created.
764-
ccx.finished_tydescs = true;
764+
*ccx.finished_tydescs = true;
765765
for ccx.tydescs.each_value |&val| {
766766
let glue_fn_ty = T_ptr(T_generic_glue_fn(ccx));
767767
let ti = val;

0 commit comments

Comments
 (0)