You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This table is a part of libcore, and gets linked with every contract. It's not possible to opt-out of unicode support (which is sort-of a design bug for core), but it can be eliminated by the linker if it isn't actually used. Naturally, .to_lowercase() uses the table and prevents the linker from eliminating it.
We should do the following:
write some kind of a test that demonstrates that today contracts include this table (probably need to actually call this function)
We have this snippet of code in the sdk right now:
near-sdk-rs/near-sdk/src/json_types/public_key.rs
Lines 27 to 31 in 763e23c
It has two problems. The minor one is that
to_lowercase
allocates a string, while we can do this comparison without allocations.The bigger problem is that
.to_lowercase()
does unicode-aware case conversion. Such conversion requires a sizable unicode table:https://github.com/rust-lang/rust/blob/5249414809d40fe22eca0c36105a2f71b9006e04/library/core/src/unicode/unicode_data.rs#L576-L1386
This table is a part of libcore, and gets linked with every contract. It's not possible to opt-out of unicode support (which is sort-of a design bug for core), but it can be eliminated by the linker if it isn't actually used. Naturally,
.to_lowercase()
uses the table and prevents the linker from eliminating it.We should do the following:
to_lowercase
with [eq_ignore_ascii_case
](https://doc.rust-lang.org/stable/std/primitive.str.html#method.eq_ignore_ascii_case)The text was updated successfully, but these errors were encountered: