Skip to content

Commit 10f90f9

Browse files
committed
---
yaml --- r: 147551 b: refs/heads/try2 c: 6db9a8c h: refs/heads/master i: 147549: d2139f6 147547: b51e452 147543: 614ddfe 147535: 7de5156 147519: 29a5a43 v: v3
1 parent f22623d commit 10f90f9

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-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: d503fff28ef8498e9e4ba9fb36f63f6905e882a7
8+
refs/heads/try2: 6db9a8c55cc45afb5b28f67352f32507188094f5
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: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ enum ModuleKind {
416416
/// One node in the tree of modules.
417417
struct Module {
418418
parent_link: ParentLink,
419-
def_id: Option<DefId>,
419+
def_id: Cell<Option<DefId>>,
420420
kind: Cell<ModuleKind>,
421421
is_public: bool,
422422

@@ -467,7 +467,7 @@ impl Module {
467467
-> Module {
468468
Module {
469469
parent_link: parent_link,
470-
def_id: def_id,
470+
def_id: Cell::new(def_id),
471471
kind: Cell::new(kind),
472472
is_public: is_public,
473473
children: @mut HashMap::new(),
@@ -668,7 +668,7 @@ impl NameBindings {
668668
None => {
669669
match type_def.module_def {
670670
Some(module) => {
671-
match module.def_id {
671+
match module.def_id.get() {
672672
Some(did) => Some(DefMod(did)),
673673
None => None,
674674
}
@@ -1591,7 +1591,7 @@ impl Resolver {
15911591
let is_public = vis == ast::public;
15921592
let is_exported = is_public && match new_parent {
15931593
ModuleReducedGraphParent(module) => {
1594-
match module.def_id {
1594+
match module.def_id.get() {
15951595
None => true,
15961596
Some(did) => self.external_exports.contains(&did)
15971597
}
@@ -1607,7 +1607,7 @@ impl Resolver {
16071607
Some(TypeNsDef { module_def: Some(module_def), .. }) => {
16081608
debug!("(building reduced graph for external crate) \
16091609
already created module");
1610-
module_def.def_id = Some(def_id);
1610+
module_def.def_id.set(Some(def_id));
16111611
}
16121612
Some(_) | None => {
16131613
debug!("(building reduced graph for \
@@ -1869,7 +1869,7 @@ impl Resolver {
18691869
debug!("(populating external module) attempting to populate {}",
18701870
self.module_to_str(module));
18711871

1872-
let def_id = match module.def_id {
1872+
let def_id = match module.def_id.get() {
18731873
None => {
18741874
debug!("(populating external module) ... no def ID!");
18751875
return
@@ -1904,7 +1904,10 @@ impl Resolver {
19041904
fn build_reduced_graph_for_external_crate(&mut self,
19051905
root: @mut Module) {
19061906
csearch::each_top_level_item_of_crate(self.session.cstore,
1907-
root.def_id.unwrap().crate,
1907+
root.def_id
1908+
.get()
1909+
.unwrap()
1910+
.crate,
19081911
|def_like, ident, visibility| {
19091912
self.build_reduced_graph_for_external_crate_def(root,
19101913
def_like,
@@ -2568,7 +2571,7 @@ impl Resolver {
25682571
}
25692572

25702573
// Record the destination of this import
2571-
match containing_module.def_id {
2574+
match containing_module.def_id.get() {
25722575
Some(did) => {
25732576
self.def_map.insert(id, DefMod(did));
25742577
self.last_private.insert(id, lp);
@@ -2667,7 +2670,8 @@ impl Resolver {
26672670
// resolving this import chain.
26682671
if !used_proxy &&
26692672
!search_module.is_public {
2670-
match search_module.def_id {
2673+
match search_module.def_id
2674+
.get() {
26712675
Some(did) => {
26722676
closest_private =
26732677
DependsOn(did);
@@ -2787,7 +2791,9 @@ impl Resolver {
27872791
Success(PrefixFound(containing_module, index)) => {
27882792
search_module = containing_module;
27892793
start_index = index;
2790-
last_private = DependsOn(containing_module.def_id.unwrap());
2794+
last_private = DependsOn(containing_module.def_id
2795+
.get()
2796+
.unwrap());
27912797
}
27922798
}
27932799

@@ -3196,7 +3202,7 @@ impl Resolver {
31963202
// If this isn't a local crate, then bail out. We don't need to record
31973203
// exports for nonlocal crates.
31983204

3199-
match module_.def_id {
3205+
match module_.def_id.get() {
32003206
Some(def_id) if def_id.crate == LOCAL_CRATE => {
32013207
// OK. Continue.
32023208
debug!("(recording exports for module subtree) recording \
@@ -3241,7 +3247,7 @@ impl Resolver {
32413247
let mut exports2 = ~[];
32423248

32433249
self.add_exports_for_module(&mut exports2, module_);
3244-
match module_.def_id {
3250+
match module_.def_id.get() {
32453251
Some(def_id) => {
32463252
self.export_map2.insert(def_id.node, exports2);
32473253
debug!("(computing exports) writing exports for {} (some)",
@@ -4644,7 +4650,7 @@ impl Resolver {
46444650
match containing_module.external_module_children.find(&name.name) {
46454651
None => {}
46464652
Some(module) => {
4647-
match module.def_id {
4653+
match module.def_id.get() {
46484654
None => {} // Continue.
46494655
Some(def_id) => {
46504656
let lp = if module.is_public {AllPublic} else {
@@ -4707,7 +4713,7 @@ impl Resolver {
47074713
TraitModuleKind | ImplModuleKind => {
47084714
match self.method_map.find(&ident.name) {
47094715
Some(s) => {
4710-
match containing_module.def_id {
4716+
match containing_module.def_id.get() {
47114717
Some(def_id) if s.contains(&def_id) => {
47124718
debug!("containing module was a trait or impl \
47134719
and name was a method -> not resolved");

0 commit comments

Comments
 (0)