Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Experiment with a safe adoption API #47

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove higher-rank trait bound on mark function in Trace::yield_owned…
…_rcs

This ensures that yielded Rcs have the same lifetime as self, which is what
we want to assert that self owns the Rc.
  • Loading branch information
lopopolo committed Jun 15, 2021
commit a96fd20d779374539e7bfad2f14b4adc60aa9509
2 changes: 1 addition & 1 deletion src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pub trait Trace: Sized {
/// TODO: document me!
fn yield_owned_rcs<F>(&self, mark: F)
where
F: for<'a> FnMut(&'a mut Rc<Self>);
F: FnMut(&mut Rc<Self>);
}
2 changes: 1 addition & 1 deletion tests/leak_doubly_linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct Node<T> {
impl<T> Trace for NodeCell<T> {
fn yield_owned_rcs<F>(&self, mut mark: F)
where
F: for<'a> FnMut(&'a mut Rc<Self>),
F: FnMut(&mut Rc<Self>),
{
if let Some(ref mut prev) = self.borrow_mut().prev {
mark(prev);
Expand Down