From 344ce1703616dc329dc11f827d91f71ca25205fc Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Tue, 22 Apr 2014 02:41:05 +0300 Subject: [PATCH] rustc: de-@ debuginfo. --- src/librustc/middle/trans/debuginfo.rs | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index d01157e53a8..d1c1eb8443a 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -57,7 +57,7 @@ For example, the following simple type for a singly-linked list... ``` struct List { value: int, - tail: Option<@List>, + tail: Option<~List>, } ``` @@ -66,8 +66,8 @@ will generate the following callstack with a naive DFS algorithm: ``` describe(t = List) describe(t = int) - describe(t = Option<@List>) - describe(t = @List) + describe(t = Option<~List>) + describe(t = ~List) describe(t = List) // at the beginning again... ... ``` @@ -144,7 +144,7 @@ use util::ppaux; use std::c_str::{CString, ToCStr}; use std::cell::{Cell, RefCell}; -use std::rc::Rc; +use std::rc::{Rc, Weak}; use collections::HashMap; use collections::HashSet; use libc::{c_uint, c_ulonglong, c_longlong}; @@ -181,7 +181,7 @@ pub struct CrateDebugContext { created_files: RefCell>, created_types: RefCell>, created_enum_disr_types: RefCell>, - namespace_map: RefCell , @NamespaceTreeNode>>, + namespace_map: RefCell, Rc>>, // This collection is used to assert that composite types (structs, enums, ...) have their // members only set once: composite_types_completed: RefCell>, @@ -2831,14 +2831,14 @@ fn populate_scope_map(cx: &CrateContext, struct NamespaceTreeNode { name: ast::Name, scope: DIScope, - parent: Option<@NamespaceTreeNode>, + parent: Option>, } impl NamespaceTreeNode { fn mangled_name_of_contained_item(&self, item_name: &str) -> ~str { fn fill_nested(node: &NamespaceTreeNode, output: &mut StrBuf) { match node.parent { - Some(parent) => fill_nested(parent, output), + Some(ref parent) => fill_nested(&*parent.upgrade().unwrap(), output), None => {} } let string = token::get_name(node.name); @@ -2855,7 +2855,7 @@ impl NamespaceTreeNode { } } -fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNode { +fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc { ty::with_path(cx.tcx(), def_id, |path| { // prepend crate name if not already present let krate = if def_id.krate == ast::LOCAL_CRATE { @@ -2867,7 +2867,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNo let mut path = krate.move_iter().chain(path).peekable(); let mut current_key = Vec::new(); - let mut parent_node: Option<@NamespaceTreeNode> = None; + let mut parent_node: Option> = None; // Create/Lookup namespace for each element of the path. loop { @@ -2891,7 +2891,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNo None => { // create and insert let parent_scope = match parent_node { - Some(node) => node.scope, + Some(ref node) => node.scope, None => ptr::null() }; let namespace_name = token::get_name(name); @@ -2908,14 +2908,14 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> @NamespaceTreeNo } }); - let node = @NamespaceTreeNode { + let node = Rc::new(NamespaceTreeNode { name: name, scope: scope, - parent: parent_node, - }; + parent: parent_node.map(|parent| parent.downgrade()), + }); debug_context(cx).namespace_map.borrow_mut() - .insert(current_key.clone(), node); + .insert(current_key.clone(), node.clone()); node }