Skip to content

Commit fc92f92

Browse files
committed
librustc: De-@mut CrateContext::finished_tydescs.
1 parent 462a791 commit fc92f92

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc/middle/trans/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use middle::trans::type_::Type;
2727

2828
use util::sha2::Sha256;
2929

30-
use std::cell::RefCell;
30+
use std::cell::{Cell, RefCell};
3131
use std::c_str::ToCStr;
3232
use std::hashmap::{HashMap, HashSet};
3333
use std::local_data;
@@ -55,7 +55,7 @@ pub struct CrateContext {
5555
tydescs: RefCell<HashMap<ty::t, @mut tydesc_info>>,
5656
// Set when running emit_tydescs to enforce that no more tydescs are
5757
// created.
58-
finished_tydescs: bool,
58+
finished_tydescs: Cell<bool>,
5959
// Track mapping of external ids to local items imported for inlining
6060
external: RefCell<HashMap<ast::DefId, Option<ast::NodeId>>>,
6161
// Backwards version of the `external` map (inlined items to where they
@@ -189,7 +189,7 @@ impl CrateContext {
189189
item_symbols: RefCell::new(HashMap::new()),
190190
link_meta: link_meta,
191191
tydescs: RefCell::new(HashMap::new()),
192-
finished_tydescs: false,
192+
finished_tydescs: Cell::new(false),
193193
external: RefCell::new(HashMap::new()),
194194
external_srcs: RefCell::new(HashMap::new()),
195195
non_inlineable_statics: RefCell::new(HashSet::new()),

src/librustc/middle/trans/glue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ pub fn incr_refcnt_of_boxed(cx: @Block, box_ptr: ValueRef) {
589589
pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
590590
// If emit_tydescs already ran, then we shouldn't be creating any new
591591
// tydescs.
592-
assert!(!ccx.finished_tydescs);
592+
assert!(!ccx.finished_tydescs.get());
593593

594594
let llty = type_of(ccx, t);
595595

@@ -694,7 +694,7 @@ pub fn make_generic_glue(ccx: @mut CrateContext,
694694
pub fn emit_tydescs(ccx: &mut CrateContext) {
695695
let _icx = push_ctxt("emit_tydescs");
696696
// As of this point, allow no more tydescs to be created.
697-
ccx.finished_tydescs = true;
697+
ccx.finished_tydescs.set(true);
698698
let glue_fn_ty = Type::generic_glue_fn(ccx).ptr_to();
699699
let mut tyds = ccx.tydescs.borrow_mut();
700700
for (_, &val) in tyds.get().iter() {

0 commit comments

Comments
 (0)