Skip to content

Commit 03f3323

Browse files
committed
---
yaml --- r: 229317 b: refs/heads/try c: 8e24091 h: refs/heads/master i: 229315: fc6cf1d v: v3
1 parent e24c40d commit 03f3323

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 751675938edef0e904086b29dc4d15bdaf519a41
4+
refs/heads/try: 8e24091f98675390620172ba25fbfbbea87d150b
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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/try/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/try/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)