Skip to content

Commit 9707e83

Browse files
committed
---
yaml --- r: 147651 b: refs/heads/try2 c: de6eb2b h: refs/heads/master i: 147649: eef0cf4 147647: 3c2659e v: v3
1 parent d4f7b6b commit 9707e83

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: ccb18f47e25daee22f151f3d21774eec38abdbe3
8+
refs/heads/try2: de6eb2b2906cb959ce374306c28c535c5e799982
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ struct ImportResolution {
351351
// The number of outstanding references to this name. When this reaches
352352
// zero, outside modules can count on the targets being correct. Before
353353
// then, all bets are off; future imports could override this name.
354-
outstanding_references: uint,
354+
outstanding_references: Cell<uint>,
355355

356356
/// The value that this `use` directive names, if there is one.
357357
value_target: Option<Target>,
@@ -371,7 +371,7 @@ impl ImportResolution {
371371
ImportResolution {
372372
type_id: id,
373373
value_id: id,
374-
outstanding_references: 0,
374+
outstanding_references: Cell::new(0),
375375
value_target: None,
376376
type_target: None,
377377
is_public: is_public,
@@ -1968,7 +1968,8 @@ impl Resolver {
19681968
Some(&resolution) => {
19691969
debug!("(building import directive) bumping \
19701970
reference");
1971-
resolution.outstanding_references += 1;
1971+
resolution.outstanding_references.set(
1972+
resolution.outstanding_references.get() + 1);
19721973

19731974
// the source of this name is different now
19741975
resolution.type_id = id;
@@ -1977,7 +1978,7 @@ impl Resolver {
19771978
None => {
19781979
debug!("(building import directive) creating new");
19791980
let resolution = @mut ImportResolution::new(id, is_public);
1980-
resolution.outstanding_references = 1;
1981+
resolution.outstanding_references.set(1);
19811982
import_resolutions.get().insert(target.name,
19821983
resolution);
19831984
}
@@ -2328,7 +2329,7 @@ impl Resolver {
23282329
}
23292330
}
23302331
Some(import_resolution)
2331-
if import_resolution.outstanding_references
2332+
if import_resolution.outstanding_references.get()
23322333
== 0 => {
23332334

23342335
fn get_binding(this: &mut Resolver,
@@ -2453,8 +2454,9 @@ impl Resolver {
24532454
}
24542455
let used_public = used_reexport || used_public;
24552456

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);
24582460

24592461
// record what this import resolves to for later uses in documentation,
24602462
// this may resolve to either a value or a type, but for documentation
@@ -3181,7 +3183,7 @@ impl Resolver {
31813183
match import_resolutions.get().find(&name.name) {
31823184
Some(import_resolution) => {
31833185
if import_resolution.is_public &&
3184-
import_resolution.outstanding_references != 0 {
3186+
import_resolution.outstanding_references.get() != 0 {
31853187
debug!("(resolving name in module) import \
31863188
unresolved; bailing out");
31873189
return Indeterminate;

0 commit comments

Comments
 (0)