Skip to content

Commit 6ea0627

Browse files
committed
---
yaml --- r: 227133 b: refs/heads/auto c: 8e24091 h: refs/heads/master i: 227131: 03a6e68 v: v3
1 parent 1396aaa commit 6ea0627

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 751675938edef0e904086b29dc4d15bdaf519a41
11+
refs/heads/auto: 8e24091f98675390620172ba25fbfbbea87d150b
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
928928
self.unresolved_imports += 1;
929929

930930
if is_public {
931-
module_.pub_count.set(module_.pub_count.get() + 1);
931+
module_.inc_pub_count();
932932
}
933933

934934
// Bump the reference count on the name. Or, if this is a glob, set
@@ -963,9 +963,9 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
963963
// Set the glob flag. This tells us that we don't know the
964964
// module's exports ahead of time.
965965

966-
module_.glob_count.set(module_.glob_count.get() + 1);
966+
module_.inc_glob_count();
967967
if is_public {
968-
module_.pub_glob_count.set(module_.pub_glob_count.get() + 1);
968+
module_.inc_pub_glob_count();
969969
}
970970
}
971971
}

branches/auto/src/librustc_resolve/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,30 @@ impl Module {
749749
}
750750
}
751751

752+
impl Module {
753+
pub fn inc_glob_count(&self) {
754+
self.glob_count.set(self.glob_count.get() + 1);
755+
}
756+
pub fn dec_glob_count(&self) {
757+
assert!(self.glob_count.get() > 0);
758+
self.glob_count.set(self.glob_count.get() - 1);
759+
}
760+
pub fn inc_pub_count(&self) {
761+
self.pub_count.set(self.pub_count.get() + 1);
762+
}
763+
pub fn dec_pub_count(&self) {
764+
assert!(self.pub_count.get() > 0);
765+
self.pub_count.set(self.pub_count.get() - 1);
766+
}
767+
pub fn inc_pub_glob_count(&self) {
768+
self.pub_glob_count.set(self.pub_glob_count.get() + 1);
769+
}
770+
pub fn dec_pub_glob_count(&self) {
771+
assert!(self.pub_glob_count.get() > 0);
772+
self.pub_glob_count.set(self.pub_glob_count.get() - 1);
773+
}
774+
}
775+
752776
impl fmt::Debug for Module {
753777
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
754778
write!(f, "{:?}, kind: {:?}, {}",

branches/auto/src/librustc_resolve/resolve_imports.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,20 +407,17 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
407407
if resolution_result.success() {
408408
match import_directive.subclass {
409409
GlobImport => {
410-
assert!(module_.glob_count.get() >= 1);
411-
module_.glob_count.set(module_.glob_count.get() - 1);
410+
module_.dec_glob_count();
412411
if import_directive.is_public {
413-
assert!(module_.pub_glob_count.get() >= 1);
414-
module_.pub_glob_count.set(module_.pub_glob_count.get() - 1);
412+
module_.dec_pub_glob_count();
415413
}
416414
}
417415
SingleImport(..) => {
418416
// Ignore.
419417
}
420418
}
421419
if import_directive.is_public {
422-
assert!(module_.pub_count.get() >= 1);
423-
module_.pub_count.set(module_.pub_count.get() - 1);
420+
module_.dec_pub_count();
424421
}
425422
}
426423

0 commit comments

Comments
 (0)