提交 5bbaa3c9 编写于 作者: A Alexis Beingessner

fallout of reworking rc and arc APIs

上级 dfa4bca8
......@@ -258,7 +258,7 @@ fn block_needs_anonymous_module(&mut self, block: &Block) -> bool {
}
fn get_parent_link(&mut self, parent: &Rc<Module>, name: Name) -> ParentLink {
ModuleParentLink(parent.downgrade(), name)
ModuleParentLink(Rc::downgrade(parent), name)
}
/// Constructs the reduced graph for one item.
......@@ -390,7 +390,7 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent: &Rc<Module>) ->
if let Some(crate_id) = self.session.cstore.find_extern_mod_stmt_cnum(item.id) {
let def_id = DefId { krate: crate_id, node: 0 };
self.external_exports.insert(def_id);
let parent_link = ModuleParentLink(parent.downgrade(), name);
let parent_link = ModuleParentLink(Rc::downgrade(parent), name);
let external_module = Rc::new(Module::new(parent_link,
Some(def_id),
NormalModuleKind,
......@@ -638,7 +638,7 @@ fn build_reduced_graph_for_block(&mut self, block: &Block, parent: &Rc<Module>)
block_id);
let new_module = Rc::new(Module::new(
BlockParentLink(parent.downgrade(), block_id),
BlockParentLink(Rc::downgrade(parent), block_id),
None,
AnonymousModuleKind,
false,
......
......@@ -21,11 +21,11 @@
#![feature(associated_consts)]
#![feature(borrow_state)]
#![feature(rc_weak)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(slice_splits)]
#![feature(staged_api)]
#![feature(rc_weak)]
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
......
......@@ -36,13 +36,13 @@
#![feature(path_relative_from)]
#![feature(path_relative_from)]
#![feature(quote)]
#![feature(rc_weak)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(unicode)]
#![feature(unicode)]
#![feature(vec_push_all)]
#![feature(rc_weak)]
#![allow(trivial_casts)]
......
......@@ -109,7 +109,7 @@ pub fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<Namespace
let node = Rc::new(NamespaceTreeNode {
name: name,
scope: scope,
parent: parent_node.map(|parent| parent.downgrade()),
parent: parent_node.map(|parent| Rc::downgrade(&parent)),
});
debug_context(cx).namespace_map.borrow_mut()
......
......@@ -36,7 +36,7 @@ fn main() {
let b: Rc<Baz> = a.clone();
assert_eq!(b.get(), 42);
let c: Weak<i32> = a.downgrade();
let c: Weak<i32> = Rc::downgrade(&a);
let d: Weak<Baz> = c.clone();
let _c = b.clone();
......@@ -44,5 +44,6 @@ fn main() {
let a: Rc<RefCell<i32>> = Rc::new(RefCell::new(42));
let b: Rc<RefCell<Baz>> = a.clone();
assert_eq!(b.borrow().get(), 42);
let c: Weak<RefCell<Baz>> = a.downgrade();
// FIXME
let c: Weak<RefCell<Baz>> = Rc::downgrade(&a) as Weak<_>;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册