-
Notifications
You must be signed in to change notification settings - Fork 52
#![deny(unsafe_op_in_unsafe_fn)]
#107
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
|
jonhoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on! Some mostly smaller comments
| TreeNode::get_tree_node(p_parent) | ||
| .left | ||
| .store(Shared::null(), Ordering::Relaxed); | ||
| p_parent_deref.left.store(Shared::null(), Ordering::Relaxed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why were previously re-computed get_tree_node here 🤔 There are a couple of other places too where we re-do TreeNode:;get_tree_node. But maybe those were just unnecessary.
| let guard = unsafe { Guard::unprotected() }; | ||
| let p = self.first.swap(Shared::null(), Ordering::Relaxed, &guard); | ||
| Self::drop_tree_nodes(p, drop_values, &guard); | ||
| unsafe { Self::drop_tree_nodes(p, drop_values, &guard) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing a safety comment.
| /// | ||
| /// # Safety | ||
| /// | ||
| /// This method may be called only if the pointer is valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// This method may be called only if the pointer is valid. | |
| /// This method may be called only if the currently-stored pointer is valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also require that the pointer stored in self hasn't otherwise been shared elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it's not entirely clear what "valid" means here. I think it has to say "valid as an &mut T".
| /// | ||
| /// # Safety | ||
| /// | ||
| /// This method may be called only if the pointer is valid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, too, I think we need to say exactly what validity requirement we're after.
Closes #104.
This change is