memoffset::offset_of with core::mem::offset_of.
Two things made this possible:
- That crate’s MSRV Minimum Supported Rust Versionwas above 1.77 which was when
core::mem::offset_ofwas stabilised. - The two macros should be completely compatible.
memoffsetstates that
If you’re using a rustc version greater or equal to 1.77, this crate’s offset_of!() macro simply forwards to core::mem::offset_of!().The PR was merged :) I then wondered how many other crates still unnecessarily have such a dependency on
memoffset?
crates.io showed 237 reverse dependencies, of which 1 has already accepted my PR to fix things.
I am NOT going to fix all of them
and some can’t remove this dependency because they want to support a MSRV below 1.77
but let’s have a go and fire off a bunch of PRs, shall we?
Some observations from looking at a bunch of crates and sending out a lot of PRs. MSRV is often quite unclear. Upstream MSRV can differ substantially from the MSRV in the latest release version, particularly for crates with a low release frequency. The
edition (like e.g. Rust 2021) required is sometimes not available on the declared MSRV.
Platform-specific or dev-dependencies can have more relaxed standards than the “main” codebase.
Component or helper crates in larger codebases sometimes don’t have any MSRV declared while the “main” crates do.
People are really friendly.
I’ve had nothing but good interactions with complete strangers during this project which actually brightened up my day.
It feels good, worth trying if you need a dose of positivity.
Many issues and PRs were swiftly handled and so far none were refused.
There’s low-hanging fruit in removing old dependencies.
I stumbled on this by accident but the list of other crates (partially) moved into std is substantial.
Admittedly, many uses are only as a dev-dependency.
In a year or so we can start doing the same trick by replacing uses of the
cfg-if crate with cfg_select introduced recently in 1.95.
I started thinking about what other old dependencies can be removed but
this list
from rust-lang/std-replacement-data
contains exactly that information!
Here’s a list of reverse dependencies sorted by total downloads, I stopped when total downloads dipped below 50k.