@@ -181,7 +181,7 @@ pub struct CrateDebugContext {
181
181
priv namespace_map : RefCell < HashMap < ~[ ast:: Ident ] , @NamespaceTreeNode > > ,
182
182
// This collection is used to assert that composite types (structs, enums, ...) have their
183
183
// members only set once:
184
- priv composite_types_completed : HashSet < DIType > ,
184
+ priv composite_types_completed : RefCell < HashSet < DIType > > ,
185
185
}
186
186
187
187
impl CrateDebugContext {
@@ -198,7 +198,7 @@ impl CrateDebugContext {
198
198
created_files : RefCell :: new ( HashMap :: new ( ) ) ,
199
199
created_types : RefCell :: new ( HashMap :: new ( ) ) ,
200
200
namespace_map : RefCell :: new ( HashMap :: new ( ) ) ,
201
- composite_types_completed : HashSet :: new ( ) ,
201
+ composite_types_completed : RefCell :: new ( HashSet :: new ( ) ) ,
202
202
} ;
203
203
}
204
204
}
@@ -1646,11 +1646,16 @@ fn set_members_of_composite_type(cx: &mut CrateContext,
1646
1646
// used instead of a new one created in create_struct_stub. This would cause a hard to trace
1647
1647
// assertion in DICompositeType::SetTypeArray(). The following check makes sure that we get a
1648
1648
// better error message if this should happen again due to some regression.
1649
- if debug_context ( cx) . composite_types_completed . contains ( & composite_type_metadata) {
1650
- cx. sess . span_bug ( definition_span, "debuginfo::set_members_of_composite_type() - Already \
1651
- completed forward declaration re-encountered.") ;
1652
- } else {
1653
- debug_context ( cx) . composite_types_completed . insert ( composite_type_metadata) ;
1649
+ {
1650
+ let mut composite_types_completed =
1651
+ debug_context ( cx) . composite_types_completed . borrow_mut ( ) ;
1652
+ if composite_types_completed. get ( ) . contains ( & composite_type_metadata) {
1653
+ cx. sess . span_bug ( definition_span, "debuginfo::set_members_of_composite_type() - \
1654
+ Already completed forward declaration \
1655
+ re-encountered.") ;
1656
+ } else {
1657
+ composite_types_completed. get ( ) . insert ( composite_type_metadata) ;
1658
+ }
1654
1659
}
1655
1660
1656
1661
let loc = span_start ( cx, definition_span) ;
0 commit comments