Closed
Description
Currently std generates dummy functions and panics on unsupported platforms. using binary patch to replace dummy functions is a practical way to implement support externally. but since dummy functions are currently inlined and optimized away, this is not possible.
Make dummy functions more patch-friendly would be helpful to ecosystem. I did some experimentation to prove this is possible. see #140440
The main motivation for this change is to support std time on wasm without intrusive dependencies. see #48564
This does not require std to guarantee the stability of dummy functions, and it is always the responsibility of the person doing the binary patch to check that the patch is correct.
There are still some unresolved issues
inline(never)
is not enough to prevent all optimizations, other compiler flags are needed to prevent places whereInstant::now()
is used from being optimized away.- binary patch does not work on other std functions. for example, the
File
type is actually!
on unsupported platforms.