Skip to content

Commit 8e0adb9

Browse files
committed
---
yaml --- r: 233194 b: refs/heads/beta c: 8e24091 h: refs/heads/master v: v3
1 parent 0435264 commit 8e0adb9

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
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 751675938edef0e904086b29dc4d15bdaf519a41
26+
refs/heads/beta: 8e24091f98675390620172ba25fbfbbea87d150b
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

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