all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox] lang: Remove offsetof macro
@ 2026-01-26 14:12 Maximiliano Sandoval
  0 siblings, 0 replies; only message in thread
From: Maximiliano Sandoval @ 2026-01-26 14:12 UTC (permalink / raw)
  To: pbs-devel

With rust 1.90 this will crash while running cargo test with

$ RUST_BACKTRACE=1 cargo test

null pointer dereference occurred
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /usr/src/rustc-1.90.0/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_nounwind_fmt::runtime
             at /usr/src/rustc-1.90.0/library/core/src/panicking.rs:117:22
   2: core::panicking::panic_nounwind_fmt
             at /usr/src/rustc-1.90.0/library/core/src/intrinsics/mod.rs:2367:9
   3: core::panicking::panic_null_pointer_dereference
             at /usr/src/rustc-1.90.0/library/core/src/panicking.rs:311:5
   4: rust_out::main::_doctest_main_proxmox_lang_src_lib_rs_71_0
   5: rust_out::main
   6: core::ops::function::FnOnce::call_once

Note that the deref_nullptr lint is going to be denied by default on 1.93.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---

As far as my greeping was able to tell, there should be no other users than the
docstring.

 proxmox-lang/src/lib.rs | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/proxmox-lang/src/lib.rs b/proxmox-lang/src/lib.rs
index 0abfd507..0c33710b 100644
--- a/proxmox-lang/src/lib.rs
+++ b/proxmox-lang/src/lib.rs
@@ -66,28 +66,6 @@ macro_rules! static_assert_size {
     };
 }
 
-/// Evaluates to the offset (in bytes) of a given member within a struct
-///
-/// ```
-/// # use proxmox_lang::offsetof;
-///
-/// #[repr(C)]
-/// struct Stuff {
-///     first: u32,
-///     second: u32,
-/// }
-///
-/// assert_eq!(offsetof!(Stuff, second), 4);
-///
-/// ```
-#[deprecated = "use std::mem::offset_of! instead"]
-#[macro_export]
-macro_rules! offsetof {
-    ($ty:ty, $field:ident) => {
-        unsafe { &(*(std::ptr::null::<$ty>())).$field as *const _ as usize }
-    };
-}
-
 /// Shortcut for generating an `&'static CStr`.
 ///
 /// This takes a *string* (*not* a *byte-string*), appends a terminating zero, and calls
-- 
2.47.3



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-26 14:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-26 14:12 [pbs-devel] [PATCH proxmox] lang: Remove offsetof macro Maximiliano Sandoval

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal