External Publication
Visit Post

[Pre-RFC] BTF relocations

Rust Internals [Unofficial] April 10, 2026
Source

Currently, in Rust, it is possible to replace every field access by a use of offset with a compile-time constant determined with offset_of! (except for field with a dyn Trait unsized tail). That's no longer true with this proposal. So this proposal is making deep changes to the foundations of the language itself, its operational semantics. This is way more than just a proposal for a bit of new syntax, and it doesn't just expand rustc implementation details like MIR, it expands the core language in a way that's relevant for unsafe code authors. The proposal needs to explain what the new operational semantics are, and how they are supposed to work in a tool like Miri.

At the very least, it seems like offset_of! on such fields should fail to compile. But the changes have to go deeper than that; the assumption of a fixed layout is deeply rooted everywhere in the compiler and the language.

Discussion in the ATmosphere

Loading comments...