What is the plan with intrinsic function pointers? Attempting to use them at all right now results in ICEs. For example, you can try:
struct Foo;
fn apply_intrinsic<T>(f: extern unsafe "rust-intrinsic" fn(T), t: T) {
f(t);
}
fn main() {
let x = std::mem::forget;
let y = Foo;
apply_intrinsic(x, y);
}
Fixing the ICEs may require a plan on how function pointers to intrinsics ought to work? The way I see it, there are at least a couple of options:
- Don’t allow function pointers to intrinsics at all. Compilation would fail at the
let x = std::mem::forget
above. This seems like the best short-term fix. - Include the intrinsic function name in the ABI. The type of
x
above would then beextern unsafe "rust-instrinsic:forget" fn(Foo)
. This would allowtrans
an alternative means of getting the desired function than just using the token name, and seems like a good idea to me for other reasons. It would be a path to allowlet _x = std::mem::forget
, though the usefulness of that operation seems limited. Is this possibly a breaking change? - Anything else?
Thanks