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

util: Use ptr::addr_of over pointer arithmetics in linked_list #6561

Merged
merged 1 commit into from
May 16, 2024

Conversation

udoprog
Copy link
Contributor

@udoprog udoprog commented May 15, 2024

Minor nit, since we no longer should need to use pointer arithmetics since the stabilization of ptr::addr_of_mut!.

The SAFETY documentation is a bit odd, since it previously didn't motivate why accessing the field through UnsafeCell was OK. However, I'm not sure UnsafeCell<T> is even necessary any longer with addr_of* since we avoid intermediate references directly over self. Nevermind! Just needed a refresher.

@udoprog udoprog added the A-tokio Area: The main tokio crate label May 15, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks. This type is used in intrusive linked lists, which is why we don't want references inside it.

@Darksonn Darksonn merged commit ced7739 into tokio-rs:master May 16, 2024
77 checks passed
@udoprog udoprog deleted the util-ptr-addr-of branch May 16, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants