@@ -351,7 +351,7 @@ struct ImportResolution {
351
351
// The number of outstanding references to this name. When this reaches
352
352
// zero, outside modules can count on the targets being correct. Before
353
353
// then, all bets are off; future imports could override this name.
354
- outstanding_references : uint ,
354
+ outstanding_references : Cell < uint > ,
355
355
356
356
/// The value that this `use` directive names, if there is one.
357
357
value_target : Option < Target > ,
@@ -371,7 +371,7 @@ impl ImportResolution {
371
371
ImportResolution {
372
372
type_id : id,
373
373
value_id : id,
374
- outstanding_references : 0 ,
374
+ outstanding_references : Cell :: new ( 0 ) ,
375
375
value_target : None ,
376
376
type_target : None ,
377
377
is_public : is_public,
@@ -1968,7 +1968,8 @@ impl Resolver {
1968
1968
Some ( & resolution) => {
1969
1969
debug ! ( "(building import directive) bumping \
1970
1970
reference") ;
1971
- resolution. outstanding_references += 1 ;
1971
+ resolution. outstanding_references . set (
1972
+ resolution. outstanding_references . get ( ) + 1 ) ;
1972
1973
1973
1974
// the source of this name is different now
1974
1975
resolution. type_id = id;
@@ -1977,7 +1978,7 @@ impl Resolver {
1977
1978
None => {
1978
1979
debug ! ( "(building import directive) creating new" ) ;
1979
1980
let resolution = @mut ImportResolution :: new ( id, is_public) ;
1980
- resolution. outstanding_references = 1 ;
1981
+ resolution. outstanding_references . set ( 1 ) ;
1981
1982
import_resolutions. get ( ) . insert ( target. name ,
1982
1983
resolution) ;
1983
1984
}
@@ -2328,7 +2329,7 @@ impl Resolver {
2328
2329
}
2329
2330
}
2330
2331
Some ( import_resolution)
2331
- if import_resolution. outstanding_references
2332
+ if import_resolution. outstanding_references . get ( )
2332
2333
== 0 => {
2333
2334
2334
2335
fn get_binding ( this : & mut Resolver ,
@@ -2453,8 +2454,9 @@ impl Resolver {
2453
2454
}
2454
2455
let used_public = used_reexport || used_public;
2455
2456
2456
- assert ! ( import_resolution. outstanding_references >= 1 ) ;
2457
- import_resolution. outstanding_references -= 1 ;
2457
+ assert ! ( import_resolution. outstanding_references. get( ) >= 1 ) ;
2458
+ import_resolution. outstanding_references . set (
2459
+ import_resolution. outstanding_references . get ( ) - 1 ) ;
2458
2460
2459
2461
// record what this import resolves to for later uses in documentation,
2460
2462
// this may resolve to either a value or a type, but for documentation
@@ -3181,7 +3183,7 @@ impl Resolver {
3181
3183
match import_resolutions. get ( ) . find ( & name. name ) {
3182
3184
Some ( import_resolution) => {
3183
3185
if import_resolution. is_public &&
3184
- import_resolution. outstanding_references != 0 {
3186
+ import_resolution. outstanding_references . get ( ) != 0 {
3185
3187
debug ! ( "(resolving name in module) import \
3186
3188
unresolved; bailing out") ;
3187
3189
return Indeterminate ;
0 commit comments