Elektrine lite

← Feed

@bal4e@tech.lgbt

2026-04-16 16:27 UTC

The main problem I encountered with this approach was that Rust would not always inline everything; the generics, the safe functions forwarding to #[target_feature] and the necessary overhead of building a "nice" API left LLVM dissatisfied. Furthermore, it was hard to replicate cfg! / cfg_select! in this model. I looked into type system abuse (e.g. https://docs.rs/frunk) but I didn't find a satisfying solution. auto traits (given their limited specialization capabilities) might help.

Replies (1)

  • @folkertdev@hachyderm.io 2026-04-16 17:17

    @bal4e A problem with generics + proof objects currently is that inlining becomes load-bearing for correctness because functions don't have the required target features. There have been ideas of using effects (so like the WIP const polymorphism, but more general) to effectively make all downstream functions have the necessary target features. And then there is still the problem of how to dispatch. I believe we disqualified ifuncs as too hacky/fragile at some point, though I don't remember the details. In any case the stdlib implementation is bad when asking for multiple target features, it would be neat if we could move it into core, etc.

    Open ##1411456