-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-offset_of`#![feature(offset_of)]``#![feature(offset_of)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Feature gates tracked by this issue:
#![feature(offset_of)]
-> moved to Tracking Issue for enum access in offset_of #120141#![feature(offset_of_enum)]
This is a tracking issue for the offset_of!
macro which evaluates to a constant
containing the offset in bytes of a field inside some type (rust-lang/rfcs#3308).
Public API
// core::mem
pub macro offset_of($Container:ty, $field:tt $(,)?) {
// ...implementation defined...
}
Steps / History
- Implementation: Add offset_of! macro (RFC 3308) #106934
- Split off
offset_of_enum
: Feature gate enums in offset_of #117537 - Final comment period (FCP)1: old, new
- Stabilization PR: Stabilize single-field offset_of #118799
Possible future extensions / work
- Support for static alignment DSTs (
struct Example(u32, [u8])
) - Support for
enum
s: Support enum variants in offset_of! #114208 - Improving diagnostics around the macro errors
Unresolved Questions
- None yet.
Footnotes
rongcuid, tgross35, PathogenDavid, swarnim-deepsource, nanoqsh and 12 morecoolreader18 and xandfury
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-offset_of`#![feature(offset_of)]``#![feature(offset_of)]`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.