Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf-8 comparisons index out of range #1

Open
experimenti opened this issue May 24, 2019 · 0 comments
Open

utf-8 comparisons index out of range #1

experimenti opened this issue May 24, 2019 · 0 comments

Comments

@experimenti
Copy link

Thanks for the contribution. The performance is great.

Getting an error on text with extended encoding:

The runtime error:
<unnamed>' panicked at 'index out of bounds: the len is 17 but the index is 17', /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libcore/slice/mod.rs:2695:10

1 failing unit test

 #[test]
    fn encoded_case() {
        assert_eq!(1, simple("LA CONNEXION FRANÇAISE LTD", "LA CONNEXION FRANÇAISE LTD"));
    }

Trace

   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   8: core::panicking::panic_bounds_check
             at src/libcore/panicking.rs:61
   9: <usize as core::slice::SliceIndex<[T]>>::index
             at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libcore/slice/mod.rs:2695
  10: core::slice::<impl core::ops::index::Index<I> for [T]>::index
             at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libcore/slice/mod.rs:2552
  11: <alloc::vec::Vec<T> as core::ops::index::Index<I>>::index
             at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/liballoc/vec.rs:1687
  12: sift4::sift4_offset
             at src/lib.rs:64
  13: sift4::simple
             at src/lib.rs:20
  14: sift4::tests::encoded_case
             at src/lib.rs:118
  15: sift4::tests::encoded_case::{{closure}}
             at src/lib.rs:117
  16: core::ops::function::FnOnce::call_once
             at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libcore/ops/function.rs:231
  17: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
             at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/liballoc/boxed.rs:704
  18: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:85
  19: test::run_test::run_test_inner::{{closure}}
             at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libstd/panicking.rs:272
             at /rustc/6afcb5628523b0baae5704ad34ac1aba8ba10de6/src/libstd/panic.rs:388
             at src/libtest/lib.rs:1467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant