Skip to content

Commit 38be67a

Browse files
committed
librustc: De-@mut CrateDebugContext::created_types.
1 parent 6ac286b commit 38be67a

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/librustc/middle/trans/debuginfo.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ pub struct CrateDebugContext {
177177
priv builder: DIBuilderRef,
178178
priv current_debug_location: DebugLocation,
179179
priv created_files: RefCell<HashMap<~str, DIFile>>,
180-
priv created_types: HashMap<uint, DIType>,
180+
priv created_types: RefCell<HashMap<uint, DIType>>,
181181
priv namespace_map: HashMap<~[ast::Ident], @NamespaceTreeNode>,
182182
// This collection is used to assert that composite types (structs, enums, ...) have their
183183
// members only set once:
@@ -196,7 +196,7 @@ impl CrateDebugContext {
196196
builder: builder,
197197
current_debug_location: UnknownLocation,
198198
created_files: RefCell::new(HashMap::new()),
199-
created_types: HashMap::new(),
199+
created_types: RefCell::new(HashMap::new()),
200200
namespace_map: HashMap::new(),
201201
composite_types_completed: HashSet::new(),
202202
};
@@ -1238,7 +1238,11 @@ impl RecursiveTypeDescription {
12381238
member_description_factory
12391239
} => {
12401240
// Insert the stub into the cache in order to allow recursive references ...
1241-
debug_context(cx).created_types.insert(cache_id, metadata_stub);
1241+
{
1242+
let mut created_types = debug_context(cx).created_types
1243+
.borrow_mut();
1244+
created_types.get().insert(cache_id, metadata_stub);
1245+
}
12421246

12431247
// ... then create the member descriptions ...
12441248
let member_descriptions = member_description_factory.
@@ -2042,9 +2046,13 @@ fn type_metadata(cx: &mut CrateContext,
20422046
usage_site_span: Span)
20432047
-> DIType {
20442048
let cache_id = cache_id_for_type(t);
2045-
match debug_context(cx).created_types.find(&cache_id) {
2046-
Some(type_metadata) => return *type_metadata,
2047-
None => ()
2049+
2050+
{
2051+
let created_types = debug_context(cx).created_types.borrow();
2052+
match created_types.get().find(&cache_id) {
2053+
Some(type_metadata) => return *type_metadata,
2054+
None => ()
2055+
}
20482056
}
20492057

20502058
fn create_pointer_to_box_metadata(cx: &mut CrateContext,
@@ -2158,7 +2166,8 @@ fn type_metadata(cx: &mut CrateContext,
21582166
_ => cx.sess.bug(format!("debuginfo: unexpected type in type_metadata: {:?}", sty))
21592167
};
21602168

2161-
debug_context(cx).created_types.insert(cache_id, type_metadata);
2169+
let mut created_types = debug_context(cx).created_types.borrow_mut();
2170+
created_types.get().insert(cache_id, type_metadata);
21622171
return type_metadata;
21632172
}
21642173

0 commit comments

Comments
 (0)