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

#![deny(unsafe_op_in_unsafe_fn)] #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ibraheemdev
Copy link
Collaborator

@ibraheemdev ibraheemdev commented Jun 20, 2022

Closes #104.


This change is Reviewable

@codecov
Copy link

codecov bot commented Jun 20, 2022

Codecov Report

Merging #107 (eee353a) into master (85ac469) will decrease coverage by 1.52%.
The diff coverage is 84.00%.

Impacted Files Coverage Δ
src/lib.rs 16.12% <ø> (ø)
src/map.rs 79.28% <ø> (-1.30%) ⬇️
src/node.rs 77.86% <81.81%> (-0.67%) ⬇️
src/reclaim.rs 86.00% <100.00%> (ø)
src/raw/mod.rs 81.08% <0.00%> (+1.35%) ⬆️

Copy link
Owner

@jonhoo jonhoo left a 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);
Copy link
Owner

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 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) }
Copy link
Owner

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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// This method may be called only if the pointer is valid.
/// This method may be called only if the currently-stored pointer is valid.

Copy link
Owner

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?

Copy link
Owner

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#![deny(unsafe_op_in_unsafe_fn)]
2 participants