@@ -361,7 +361,7 @@ struct ImportResolution {
361
361
value_id : Cell < NodeId > ,
362
362
363
363
/// The type that this `use` directive names, if there is one.
364
- type_target : Option < Target > ,
364
+ type_target : RefCell < Option < Target > > ,
365
365
/// The source node of the `use` directive leading to the type target
366
366
/// being non-none
367
367
type_id : NodeId ,
@@ -374,15 +374,15 @@ impl ImportResolution {
374
374
value_id : Cell :: new ( id) ,
375
375
outstanding_references : Cell :: new ( 0 ) ,
376
376
value_target : RefCell :: new ( None ) ,
377
- type_target : None ,
377
+ type_target : RefCell :: new ( None ) ,
378
378
is_public : Cell :: new ( is_public) ,
379
379
}
380
380
}
381
381
382
382
fn target_for_namespace ( & self , namespace : Namespace )
383
383
-> Option < Target > {
384
384
match namespace {
385
- TypeNS => return self . type_target ,
385
+ TypeNS => return self . type_target . get ( ) ,
386
386
ValueNS => return self . value_target . get ( ) ,
387
387
}
388
388
}
@@ -2433,8 +2433,8 @@ impl Resolver {
2433
2433
BoundResult ( target_module, name_bindings) => {
2434
2434
debug ! ( "(resolving single import) found type target: {:?}" ,
2435
2435
name_bindings. type_def. get( ) . unwrap( ) . type_def) ;
2436
- import_resolution. type_target =
2437
- Some ( Target :: new ( target_module, name_bindings) ) ;
2436
+ import_resolution. type_target . set (
2437
+ Some ( Target :: new ( target_module, name_bindings) ) ) ;
2438
2438
import_resolution. type_id = directive. id ;
2439
2439
used_public = name_bindings. defined_in_public_namespace ( TypeNS ) ;
2440
2440
}
@@ -2445,7 +2445,7 @@ impl Resolver {
2445
2445
}
2446
2446
2447
2447
if import_resolution. value_target . get ( ) . is_none ( ) &&
2448
- import_resolution. type_target . is_none ( ) {
2448
+ import_resolution. type_target . get ( ) . is_none ( ) {
2449
2449
let msg = format ! ( "unresolved import: there is no \
2450
2450
`{}` in `{}`",
2451
2451
self . session. str_of( source) ,
@@ -2472,7 +2472,7 @@ impl Resolver {
2472
2472
}
2473
2473
None => { }
2474
2474
}
2475
- match import_resolution. type_target {
2475
+ match import_resolution. type_target . get ( ) {
2476
2476
Some ( target) => {
2477
2477
let def = target. bindings . def_for_namespace ( TypeNS ) . unwrap ( ) ;
2478
2478
self . def_map . insert ( directive. id , def) ;
@@ -2519,7 +2519,7 @@ impl Resolver {
2519
2519
. iter ( ) {
2520
2520
debug ! ( "(resolving glob import) writing module resolution \
2521
2521
{:?} into `{}`",
2522
- target_import_resolution. type_target. is_none( ) ,
2522
+ target_import_resolution. type_target. get ( ) . is_none( ) ,
2523
2523
self . module_to_str( module_) ) ;
2524
2524
2525
2525
if !target_import_resolution. is_public . get ( ) {
@@ -2537,8 +2537,8 @@ impl Resolver {
2537
2537
@mut ImportResolution :: new ( id, is_public) ;
2538
2538
new_import_resolution. value_target . set (
2539
2539
target_import_resolution. value_target . get ( ) ) ;
2540
- new_import_resolution. type_target =
2541
- target_import_resolution. type_target ;
2540
+ new_import_resolution. type_target . set (
2541
+ target_import_resolution. type_target . get ( ) ) ;
2542
2542
2543
2543
import_resolutions. get ( ) . insert
2544
2544
( * ident, new_import_resolution) ;
@@ -2556,13 +2556,13 @@ impl Resolver {
2556
2556
Some ( value_target) ) ;
2557
2557
}
2558
2558
}
2559
- match target_import_resolution. type_target {
2559
+ match target_import_resolution. type_target . get ( ) {
2560
2560
None => {
2561
2561
// Continue.
2562
2562
}
2563
2563
Some ( type_target) => {
2564
- dest_import_resolution. type_target =
2565
- Some ( type_target) ;
2564
+ dest_import_resolution. type_target . set (
2565
+ Some ( type_target) ) ;
2566
2566
}
2567
2567
}
2568
2568
dest_import_resolution. is_public . set ( is_public) ;
@@ -2602,8 +2602,8 @@ impl Resolver {
2602
2602
}
2603
2603
if name_bindings. defined_in_public_namespace ( TypeNS ) {
2604
2604
debug ! ( "(resolving glob import) ... for type target" ) ;
2605
- dest_import_resolution. type_target =
2606
- Some ( Target :: new ( containing_module, name_bindings) ) ;
2605
+ dest_import_resolution. type_target . set (
2606
+ Some ( Target :: new ( containing_module, name_bindings) ) ) ;
2607
2607
dest_import_resolution. type_id = id;
2608
2608
}
2609
2609
dest_import_resolution. is_public . set ( is_public) ;
0 commit comments