Re:The end of the kernel Rust experiment
by vlovich123 on Wednesday December 10, 2025 @02:04AM
(#46214932)
Can you expand on bitfields? There’s crates that implement bitfield structs via macros so while not being baked into the language I’m not sure what in practice Rust isn’t able to do on that front.
[ Parent
| on HN ]
Re:The end of the kernel Rust experiment
by ZeWaka on Wednesday December 10, 2025 @02:22AM
(#46215043)
Yeah, not sure what they're saying... I use bitfields in multiple of my rust projects using those macros.
Re:The end of the kernel Rust experiment
by pjmlp on Wednesday December 10, 2025 @04:10AM
(#46215657)
Across binary libraries ABI, regardless of static or dynamically linked?
Re:The end of the kernel Rust experiment
by bigstrat2003 on Wednesday December 10, 2025 @01:38PM
(#46221603)
Dynamic linking is not something you do in general in Rust. It's possible, but the compiler currently does not guarantee a stable ABI so it's not something one generally does.
Re:The end of the kernel Rust experiment
by maweki on Wednesday December 10, 2025 @02:29AM
(#46215093)
I'm not a rust or systems programmer but I think it meant that as an ABI or foreign function interface bitfields are not stable or not intuitive to use, as they can't be declared granularily enough.
Re:The end of the kernel Rust experiment
by SAI_Peregrinus on Wednesday December 10, 2025 @10:11AM
(#46218558)
C's bit-fields ABI isn't great either. In particular, the order of allocation of bit-fields within a unit and alignment of non-bit-field structure members are implementation defined (6.7.2.1). And bit-fields of types other than `_Bool`, `signed int` and `unsigned int` are extensions to the standard, so that somewhat limits what types can have bitfields.
Re:The end of the kernel Rust experiment
by structural on Wednesday December 10, 2025 @11:00AM
(#46219309)
Now, try and use two or more libraries that expose data structures with bitfields, and they have all chosen different crates for this (or even the same crate but different, non-ABI-compatible-versions of it).
There's a ton of standardization work that really should be done before these are safe for library APIs. Mostly fine to just write an application that uses one of these crates though.