From ef846f53e67398e86374234872b9ccecd5879080 Mon Sep 17 00:00:00 2001 From: Sybrand Aarnoutse Date: Mon, 3 Aug 2026 14:37:09 +0200 Subject: [PATCH] Remove dependency on `memoffset` (#8304) Hi, I may or may not have used your crate but I'd like to say a quick thank you for it anyway! I'm going down the list of reverse dependencies on `memoffset`. This PR aims to remove the `memoffset` crate from your dependencies. [`core::mem::offset_of`](https://doc.rust-lang.org/core/mem/macro.offset_of.html) was stabilised in rustc 1.77 which I believe is at or below your MSRV. The `memoffset` crate 0.9.1 says 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!(). I consider it very unlikely (see [here](https://github.com/rust-lang/rust/issues/111839)) for any usage of the `offset_of!` macro to break but please check anyway. I hope we can all enjoy the benefits of one less dependency :) --- * [x] I have followed the instructions in the PR template *except for `./scripts/check.sh` which doesn't run in my environment* (I'm unwilling to chase it down because I'm firing off a whole bunch of these PRs to various repositories, sorry.) `cargo clippy` gives 1 unrelated warning. Co-authored-by: Emil Ernerfeldt --- Cargo.lock | 1 - Cargo.toml | 1 - crates/egui_glow/Cargo.toml | 1 - crates/egui_glow/src/painter.rs | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2bab448c0..4afcaf461 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1433,7 +1433,6 @@ dependencies = [ "glutin", "glutin-winit", "log", - "memoffset", "profiling", "winit", ] diff --git a/Cargo.toml b/Cargo.toml index 884f9c7de..f310dd9af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -102,7 +102,6 @@ jiff = { version = "0.2.35", default-features = false } js-sys = "0.3.103" kittest = { version = "0.4.0" } log = { version = "0.4.33", features = ["std"] } -memoffset = "0.9.1" mimalloc = "0.1.52" mime_guess2 = { version = "2.3", default-features = false } mint = "0.5.9" diff --git a/crates/egui_glow/Cargo.toml b/crates/egui_glow/Cargo.toml index d5a9f3716..2bd8c3109 100644 --- a/crates/egui_glow/Cargo.toml +++ b/crates/egui_glow/Cargo.toml @@ -56,7 +56,6 @@ egui-winit = { workspace = true, optional = true, default-features = false } bytemuck.workspace = true glow.workspace = true log.workspace = true -memoffset.workspace = true profiling.workspace = true #! ### Optional dependencies diff --git a/crates/egui_glow/src/painter.rs b/crates/egui_glow/src/painter.rs index 004f5d58c..2b2341da1 100644 --- a/crates/egui_glow/src/painter.rs +++ b/crates/egui_glow/src/painter.rs @@ -1,6 +1,7 @@ #![expect(clippy::unwrap_used)] #![expect(unsafe_code)] +use core::mem::offset_of; use std::{collections::HashMap, sync::Arc}; use egui::{ @@ -8,7 +9,6 @@ use egui::{ epaint::{Mesh, PaintCallbackInfo, Primitive, Vertex}, }; use glow::HasContext as _; -use memoffset::offset_of; use crate::check_for_gl_error; use crate::misc_util::{compile_shader, link_program};