tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
25.72k stars 2.35k forks source link

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

Closed udoprog closed 2 months ago

udoprog commented 2 months ago

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.