GetFirefly/firefly

Any Erlang code using `integer_to_binary/2` fails to link against a derived trait method in `radix_fmt`

KronicDeth opened this issue · 2 comments

Any Erlang code using integer_to_binary/2 fails to link against a derived trait method in radix_fmt:

Undefined symbols for architecture x86_64 _$LT$radix_fmt..Radix$LT$isize$GT$$u20$as$u20$core..fmt..Display$GT$::fmt::h9d7627ed4ffb494b

init.erl

-module(init).
-export([start/0]).
-import(erlang, [binary_to_integer/2, display/1, integer_to_binary/2]).

start() ->
  duals().

duals() ->
  duals(2, 36).

duals(MaxBase, MaxBase) ->
  dual(MaxBase);
duals(Base, MaxBase) ->
  dual(Base),
  duals(Base + 1, MaxBase).

dual(Base) ->
  display(36 == binary_to_integer(integer_to_binary(36, Base), Base)).

I'm not sure why it says _$LT$radix_fmt..Radix$LT$isize$GT$$u20$as$u20$core..fmt..Display$GT$::fmt::h9d7627ed4ffb494b because that's not a proper mangled Rust symbol name. Mangled Rust symbol names start with _ZN<NumberOfCharacters>. The proper format is __ZN68_$LT$radix_fmt..Radix$LT$isize$GT$$u20$as$u20$core..fmt..Display$GT$3fmt17h9d7627ed4ffb494bE, which demangles to _<radix_fmt::Radix<isize> as core::fmt::Display>::fmt

Closing this because it is almost certainly not an issue anymore, as much has changed since this was initially reported, but if it comes up again we can reopen