@@ -425,7 +425,7 @@ struct Module {
425
425
426
426
// The external module children of this node that were declared with
427
427
// `extern mod`.
428
- external_module_children : @ mut HashMap < Name , @Module > ,
428
+ external_module_children : RefCell < HashMap < Name , @Module > > ,
429
429
430
430
// The anonymous children of this node. Anonymous children are pseudo-
431
431
// modules that are implicitly created around items contained within
@@ -472,7 +472,7 @@ impl Module {
472
472
is_public : is_public,
473
473
children : @mut HashMap :: new ( ) ,
474
474
imports : @mut ~[ ] ,
475
- external_module_children : @ mut HashMap :: new ( ) ,
475
+ external_module_children : RefCell :: new ( HashMap :: new ( ) ) ,
476
476
anonymous_children : @mut HashMap :: new ( ) ,
477
477
import_resolutions : @mut HashMap :: new ( ) ,
478
478
glob_count : Cell :: new ( 0 ) ,
@@ -1506,9 +1506,13 @@ impl Resolver {
1506
1506
false ,
1507
1507
true ) ;
1508
1508
1509
- parent. external_module_children . insert (
1510
- name. name ,
1511
- external_module) ;
1509
+ {
1510
+ let mut external_module_children =
1511
+ parent. external_module_children . borrow_mut ( ) ;
1512
+ external_module_children. get ( ) . insert (
1513
+ name. name ,
1514
+ external_module) ;
1515
+ }
1512
1516
1513
1517
self . build_reduced_graph_for_external_crate (
1514
1518
external_module) ;
@@ -2352,13 +2356,18 @@ impl Resolver {
2352
2356
match type_result {
2353
2357
BoundResult ( ..) => { }
2354
2358
_ => {
2355
- match containing_module. external_module_children
2356
- . find ( & source. name ) {
2359
+ let module_opt = {
2360
+ let mut external_module_children =
2361
+ containing_module. external_module_children
2362
+ . borrow_mut ( ) ;
2363
+ external_module_children. get ( ) . find_copy ( & source. name )
2364
+ } ;
2365
+ match module_opt {
2357
2366
None => { } // Continue.
2358
2367
Some ( module) => {
2359
2368
let name_bindings =
2360
2369
@mut Resolver :: create_name_bindings_from_module (
2361
- * module) ;
2370
+ module) ;
2362
2371
type_result = BoundResult ( containing_module,
2363
2372
name_bindings) ;
2364
2373
used_public = true ;
@@ -2565,10 +2574,14 @@ impl Resolver {
2565
2574
}
2566
2575
2567
2576
// Add external module children from the containing module.
2568
- for ( & name, module) in containing_module. external_module_children . iter ( ) {
2569
- let name_bindings =
2570
- @mut Resolver :: create_name_bindings_from_module ( * module) ;
2571
- merge_import_resolution ( name, name_bindings) ;
2577
+ {
2578
+ let external_module_children =
2579
+ containing_module. external_module_children . borrow ( ) ;
2580
+ for ( & name, module) in external_module_children. get ( ) . iter ( ) {
2581
+ let name_bindings =
2582
+ @mut Resolver :: create_name_bindings_from_module ( * module) ;
2583
+ merge_import_resolution ( name, name_bindings) ;
2584
+ }
2572
2585
}
2573
2586
2574
2587
// Record the destination of this import
@@ -2861,12 +2874,17 @@ impl Resolver {
2861
2874
2862
2875
// Search for external modules.
2863
2876
if namespace == TypeNS {
2864
- match module_. external_module_children . find ( & name. name ) {
2877
+ let module_opt = {
2878
+ let external_module_children =
2879
+ module_. external_module_children . borrow ( ) ;
2880
+ external_module_children. get ( ) . find_copy ( & name. name )
2881
+ } ;
2882
+ match module_opt {
2865
2883
None => { }
2866
2884
Some ( module) => {
2867
2885
let name_bindings =
2868
2886
@mut Resolver :: create_name_bindings_from_module (
2869
- * module) ;
2887
+ module) ;
2870
2888
debug ! ( "lower name bindings succeeded" ) ;
2871
2889
return Success ( ( Target :: new ( module_, name_bindings) , false ) ) ;
2872
2890
}
@@ -3133,12 +3151,17 @@ impl Resolver {
3133
3151
3134
3152
// Finally, search through external children.
3135
3153
if namespace == TypeNS {
3136
- match module_. external_module_children . find ( & name. name ) {
3154
+ let module_opt = {
3155
+ let external_module_children =
3156
+ module_. external_module_children . borrow ( ) ;
3157
+ external_module_children. get ( ) . find_copy ( & name. name )
3158
+ } ;
3159
+ match module_opt {
3137
3160
None => { }
3138
3161
Some ( module) => {
3139
3162
let name_bindings =
3140
3163
@mut Resolver :: create_name_bindings_from_module (
3141
- * module) ;
3164
+ module) ;
3142
3165
return Success ( ( Target :: new ( module_, name_bindings) , false ) ) ;
3143
3166
}
3144
3167
}
@@ -4664,7 +4687,12 @@ impl Resolver {
4664
4687
4665
4688
// Finally, search through external children.
4666
4689
if namespace == TypeNS {
4667
- match containing_module. external_module_children . find ( & name. name ) {
4690
+ let module_opt = {
4691
+ let external_module_children =
4692
+ containing_module. external_module_children . borrow ( ) ;
4693
+ external_module_children. get ( ) . find_copy ( & name. name )
4694
+ } ;
4695
+ match module_opt {
4668
4696
None => { }
4669
4697
Some ( module) => {
4670
4698
match module. def_id . get ( ) {
0 commit comments