External Publication
Visit Post

[Pre-RFC] Make some feature-detected function-to-fn-pointer casts safe through ZST token types

Rust Internals [Unofficial] May 24, 2026
Source
At least some context outside the target feature attributes needs to have the ability to create that first entry point. I was not aware you could do that cast inside the context already (so soundness of this is already promised). This does change the perspective on struct-target-feature/3525 a bit: an entry point might have a target token type in its signature but it can still be used to construct many other safe function pointers with a simple signature—so those tokens already provide a useful base case. I suppose I would still prefer another (macro) way that avoids the whole function layer for ergonomics reasons. Maybe that should be discussed at the RFC directly though instead of as a competing one.

Discussion in the ATmosphere

Loading comments...