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
Nothing hapens. The method returns an error with kind Invalid which is ignored.
Observed behaviour
The code panics.
thread 'main' panicked at 'byte index 1 is not a char boundary; it is inside '™' (bytes 0..3) of `™0.2`', src/libcore/str/mod.rs:2034:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Cause analysis
The underlying cause is that slice_shift_char splits the string at a hardcode byte offset of 1 instead of the byte-length of the first character. This panics when it is not a UTF-8 byte boundary.
Thanks for the report, and your suggested fix looks great! Can you submit this as a pull request along with corresponding tests? It looks like slice_shift_char is used both at the beginning of the string and in the exponent position (for input like 1e100).
play.
Expected behaviour
Nothing hapens. The method returns an error with kind
Invalid
which is ignored.Observed behaviour
The code panics.
Cause analysis
The underlying cause is that
slice_shift_char
splits the string at a hardcode byte offset of1
instead of the byte-length of the first character. This panics when it is not a UTF-8 byte boundary.num-traits/src/lib.rs
Lines 218 to 220 in 58f02a8
The text was updated successfully, but these errors were encountered: