Skip to content

Commit

Permalink
fallout of reworking rc and arc APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankra committed Aug 19, 2015
1 parent dfa4bca commit 5bbaa3c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
}

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.
Expand Down Expand Up @@ -390,7 +390,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
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,
Expand Down Expand Up @@ -638,7 +638,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
block_id);

let new_module = Rc::new(Module::new(
BlockParentLink(parent.downgrade(), block_id),
BlockParentLink(Rc::downgrade(parent), block_id),
None,
AnonymousModuleKind,
false,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/debuginfo/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions src/test/run-pass/dst-coerce-rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ 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();

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<_>;
}

0 comments on commit 5bbaa3c

Please sign in to comment.