Skip to content

Commit 90aca67

Browse files
committed
---
yaml --- r: 147653 b: refs/heads/try2 c: 5fe8411 h: refs/heads/master i: 147651: 9707e83 v: v3
1 parent c76ac22 commit 90aca67

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
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: aa5b422267395fbdf2471acca2656ddc9f1993b7
8+
refs/heads/try2: 5fe84118a66c0f37bc8bcb3e3a0b8a235440a5ad
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: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ impl ImportDirective {
326326
}
327327

328328
/// The item that an import resolves to.
329+
#[deriving(Clone)]
329330
struct Target {
330331
target_module: @Module,
331332
bindings: @NameBindings,
@@ -354,7 +355,7 @@ struct ImportResolution {
354355
outstanding_references: Cell<uint>,
355356

356357
/// The value that this `use` directive names, if there is one.
357-
value_target: Option<Target>,
358+
value_target: RefCell<Option<Target>>,
358359
/// The source node of the `use` directive leading to the value target
359360
/// being non-none
360361
value_id: NodeId,
@@ -372,7 +373,7 @@ impl ImportResolution {
372373
type_id: id,
373374
value_id: id,
374375
outstanding_references: Cell::new(0),
375-
value_target: None,
376+
value_target: RefCell::new(None),
376377
type_target: None,
377378
is_public: Cell::new(is_public),
378379
}
@@ -382,7 +383,7 @@ impl ImportResolution {
382383
-> Option<Target> {
383384
match namespace {
384385
TypeNS => return self.type_target,
385-
ValueNS => return self.value_target,
386+
ValueNS => return self.value_target.get(),
386387
}
387388
}
388389

@@ -2418,8 +2419,8 @@ impl Resolver {
24182419
match value_result {
24192420
BoundResult(target_module, name_bindings) => {
24202421
debug!("(resolving single import) found value target");
2421-
import_resolution.value_target =
2422-
Some(Target::new(target_module, name_bindings));
2422+
import_resolution.value_target.set(
2423+
Some(Target::new(target_module, name_bindings)));
24232424
import_resolution.value_id = directive.id;
24242425
used_public = name_bindings.defined_in_public_namespace(ValueNS);
24252426
}
@@ -2443,7 +2444,7 @@ impl Resolver {
24432444
}
24442445
}
24452446

2446-
if import_resolution.value_target.is_none() &&
2447+
if import_resolution.value_target.get().is_none() &&
24472448
import_resolution.type_target.is_none() {
24482449
let msg = format!("unresolved import: there is no \
24492450
`{}` in `{}`",
@@ -2461,7 +2462,7 @@ impl Resolver {
24612462
// record what this import resolves to for later uses in documentation,
24622463
// this may resolve to either a value or a type, but for documentation
24632464
// purposes it's good enough to just favor one over the other.
2464-
match import_resolution.value_target {
2465+
match import_resolution.value_target.get() {
24652466
Some(target) => {
24662467
let def = target.bindings.def_for_namespace(ValueNS).unwrap();
24672468
self.def_map.insert(directive.id, def);
@@ -2534,8 +2535,8 @@ impl Resolver {
25342535
// Simple: just copy the old import resolution.
25352536
let new_import_resolution =
25362537
@mut ImportResolution::new(id, is_public);
2537-
new_import_resolution.value_target =
2538-
target_import_resolution.value_target;
2538+
new_import_resolution.value_target.set(
2539+
target_import_resolution.value_target.get());
25392540
new_import_resolution.type_target =
25402541
target_import_resolution.type_target;
25412542

@@ -2546,13 +2547,13 @@ impl Resolver {
25462547
// Merge the two import resolutions at a finer-grained
25472548
// level.
25482549

2549-
match target_import_resolution.value_target {
2550+
match target_import_resolution.value_target.get() {
25502551
None => {
25512552
// Continue.
25522553
}
25532554
Some(value_target) => {
2554-
dest_import_resolution.value_target =
2555-
Some(value_target);
2555+
dest_import_resolution.value_target.set(
2556+
Some(value_target));
25562557
}
25572558
}
25582559
match target_import_resolution.type_target {
@@ -2595,8 +2596,8 @@ impl Resolver {
25952596
// Merge the child item into the import resolution.
25962597
if name_bindings.defined_in_public_namespace(ValueNS) {
25972598
debug!("(resolving glob import) ... for value target");
2598-
dest_import_resolution.value_target =
2599-
Some(Target::new(containing_module, name_bindings));
2599+
dest_import_resolution.value_target.set(
2600+
Some(Target::new(containing_module, name_bindings)));
26002601
dest_import_resolution.value_id = id;
26012602
}
26022603
if name_bindings.defined_in_public_namespace(TypeNS) {

0 commit comments

Comments
 (0)