Skip to content

Commit ec02f94

Browse files
committed
librustc: De-@mut resolve::Module::resolved_import_count
1 parent 01d8380 commit ec02f94

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/librustc/middle/resolve.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ struct Module {
450450
glob_count: Cell<uint>,
451451

452452
// The index of the import we're resolving.
453-
resolved_import_count: uint,
453+
resolved_import_count: Cell<uint>,
454454

455455
// Whether this module is populated. If not populated, any attempt to
456456
// access the children must be preceded with a
@@ -476,14 +476,14 @@ impl Module {
476476
anonymous_children: @mut HashMap::new(),
477477
import_resolutions: @mut HashMap::new(),
478478
glob_count: Cell::new(0),
479-
resolved_import_count: 0,
479+
resolved_import_count: Cell::new(0),
480480
populated: Cell::new(!external),
481481
}
482482
}
483483

484484
fn all_imports_resolved(&self) -> bool {
485485
let imports = &mut *self.imports;
486-
return imports.len() == self.resolved_import_count;
486+
return imports.len() == self.resolved_import_count.get();
487487
}
488488
}
489489

@@ -2039,8 +2039,8 @@ impl Resolver {
20392039

20402040
let imports = &mut *module.imports;
20412041
let import_count = imports.len();
2042-
while module.resolved_import_count < import_count {
2043-
let import_index = module.resolved_import_count;
2042+
while module.resolved_import_count.get() < import_count {
2043+
let import_index = module.resolved_import_count.get();
20442044
let import_directive = imports[import_index];
20452045
match self.resolve_import_for_module(module, import_directive) {
20462046
Failed => {
@@ -2060,7 +2060,8 @@ impl Resolver {
20602060
}
20612061
}
20622062

2063-
module.resolved_import_count += 1;
2063+
module.resolved_import_count
2064+
.set(module.resolved_import_count.get() + 1);
20642065
}
20652066
}
20662067

@@ -3151,7 +3152,7 @@ impl Resolver {
31513152
}
31523153

31533154
fn report_unresolved_imports(&mut self, module_: @mut Module) {
3154-
let index = module_.resolved_import_count;
3155+
let index = module_.resolved_import_count.get();
31553156
let imports: &mut ~[@ImportDirective] = &mut *module_.imports;
31563157
let import_count = imports.len();
31573158
if index != import_count {

0 commit comments

Comments
 (0)