Skip to content

Commit 51fcc2e

Browse files
committed
---
yaml --- r: 111510 b: refs/heads/master c: 344ce17 h: refs/heads/master v: v3
1 parent 73f600d commit 51fcc2e

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 57aa0eb0aa0f4fc502ef8b1d3543cb02c2092932
2+
refs/heads/master: 344ce1703616dc329dc11f827d91f71ca25205fc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b5dd3f05fe95168b5569d0f519636149479eb6ac
55
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c

trunk/src/librustc/middle/trans/debuginfo.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ For example, the following simple type for a singly-linked list...
5757
```
5858
struct List {
5959
value: int,
60-
tail: Option<@List>,
60+
tail: Option<~List>,
6161
}
6262
```
6363
@@ -66,8 +66,8 @@ will generate the following callstack with a naive DFS algorithm:
6666
```
6767
describe(t = List)
6868
describe(t = int)
69-
describe(t = Option<@List>)
70-
describe(t = @List)
69+
describe(t = Option<~List>)
70+
describe(t = ~List)
7171
describe(t = List) // at the beginning again...
7272
...
7373
```
@@ -144,7 +144,7 @@ use util::ppaux;
144144

145145
use std::c_str::{CString, ToCStr};
146146
use std::cell::{Cell, RefCell};
147-
use std::rc::Rc;
147+
use std::rc::{Rc, Weak};
148148
use collections::HashMap;
149149
use collections::HashSet;
150150
use libc::{c_uint, c_ulonglong, c_longlong};
@@ -181,7 +181,7 @@ pub struct CrateDebugContext {
181181
created_files: RefCell<HashMap<~str, DIFile>>,
182182
created_types: RefCell<HashMap<uint, DIType>>,
183183
created_enum_disr_types: RefCell<HashMap<ast::DefId, DIType>>,
184-
namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
184+
namespace_map: RefCell<HashMap<Vec<ast::Name>, Rc<NamespaceTreeNode>>>,
185185
// This collection is used to assert that composite types (structs, enums, ...) have their
186186
// members only set once:
187187
composite_types_completed: RefCell<HashSet<DIType>>,
@@ -2831,14 +2831,14 @@ fn populate_scope_map(cx: &CrateContext,
28312831
struct NamespaceTreeNode {
28322832
name: ast::Name,
28332833
scope: DIScope,
2834-
parent: Option<@NamespaceTreeNode>,
2834+
parent: Option<Weak<NamespaceTreeNode>>,
28352835
}
28362836

28372837
impl NamespaceTreeNode {
28382838
fn mangled_name_of_contained_item(&self, item_name: &str) -> ~str {
28392839
fn fill_nested(node: &NamespaceTreeNode, output: &mut StrBuf) {
28402840
match node.parent {
2841-
Some(parent) => fill_nested(parent, output),
2841+
Some(ref parent) => fill_nested(&*parent.upgrade().unwrap(), output),
28422842
None => {}
28432843
}
28442844
let string = token::get_name(node.name);
@@ -2855,7 +2855,7 @@ impl NamespaceTreeNode {
28552855
}
28562856
}
28572857

2858-
fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNode {
2858+
fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTreeNode> {
28592859
ty::with_path(cx.tcx(), def_id, |path| {
28602860
// prepend crate name if not already present
28612861
let krate = if def_id.krate == ast::LOCAL_CRATE {
@@ -2867,7 +2867,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNo
28672867
let mut path = krate.move_iter().chain(path).peekable();
28682868

28692869
let mut current_key = Vec::new();
2870-
let mut parent_node: Option<@NamespaceTreeNode> = None;
2870+
let mut parent_node: Option<Rc<NamespaceTreeNode>> = None;
28712871

28722872
// Create/Lookup namespace for each element of the path.
28732873
loop {
@@ -2891,7 +2891,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNo
28912891
None => {
28922892
// create and insert
28932893
let parent_scope = match parent_node {
2894-
Some(node) => node.scope,
2894+
Some(ref node) => node.scope,
28952895
None => ptr::null()
28962896
};
28972897
let namespace_name = token::get_name(name);
@@ -2908,14 +2908,14 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNo
29082908
}
29092909
});
29102910

2911-
let node = @NamespaceTreeNode {
2911+
let node = Rc::new(NamespaceTreeNode {
29122912
name: name,
29132913
scope: scope,
2914-
parent: parent_node,
2915-
};
2914+
parent: parent_node.map(|parent| parent.downgrade()),
2915+
});
29162916

29172917
debug_context(cx).namespace_map.borrow_mut()
2918-
.insert(current_key.clone(), node);
2918+
.insert(current_key.clone(), node.clone());
29192919

29202920
node
29212921
}

0 commit comments

Comments
 (0)