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

cargo fix panics thread 'main' panicked at 'byte index 22 is not a char boundary; #7220

Closed
matthiaskrgr opened this issue Aug 6, 2019 · 2 comments · Fixed by #7221
Closed
Labels
C-bug Category: bug

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Aug 6, 2019

Steps

git clone https://github.com/rust-lang/regex
cd regex
git checkout 06e26d070d1889062b96b138eb05117300ba0ec2
RUST_BACKTRACE=Full cargo fix -Z unstable-options --clippy 

I was not able to reproduce by just running "cargo clippy" so I assume this is a cargo fix bug.

Problem
Cargo fix panics:


thread 'main' panicked at 'byte index 22 is not a char boundary; it is inside '☃' (bytes 20..23) of `mat!(uni_literal, r"☃", "☃", Some((0, 3)));`', src/libcore/str/mod.rs:2046:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   8: rust_begin_unwind
             at src/libstd/panicking.rs:311
   9: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  10: core::str::slice_error_fail
             at src/libcore/str/mod.rs:0
  11: core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::{{closure}}
  12: rustfix::parse_snippet
  13: <core::iter::adapters::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::next
  14: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  15: rustfix::collect_suggestions
  16: cargo::ops::fix::rustfix_crate
  17: cargo::ops::fix::fix_maybe_exec_rustc
  18: cargo::main
  19: std::rt::lang_start::{{closure}}
  20: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  21: std::panicking::try::do_call
             at src/libstd/panicking.rs:296
  22: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  23: std::panicking::try
             at src/libstd/panicking.rs:275
  24: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  25: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  26: main
  27: __libc_start_main
  28: <unknown>

Possible Solution(s)
Don't panic

Notes

Output of cargo version:

cargo 1.38.0-nightly (d0f828419 2019-07-23)

rustc 1.38.0-nightly (8a58268b5 2019-07-31)
binary: rustc
commit-hash: 8a58268b5ad9c4a240be349a633069d48991eb0c
commit-date: 2019-07-31
host: x86_64-unknown-linux-gnu
release: 1.38.0-nightly
LLVM version: 9.0

clippy 0.0.212 (c3e9136 2019-07-30)

@matthiaskrgr matthiaskrgr added the C-bug Category: bug label Aug 6, 2019
@ehuss
Copy link
Contributor

ehuss commented Aug 6, 2019

Thanks! This has been fixed by rust-lang/rustfix#167, but the PR seems to be a little stuck.

@alexcrichton
Copy link
Member

Ok I've published 0.4.6 of rustfix, @ehuss would you be up for pulling that into Cargo?

@ehuss ehuss mentioned this issue Aug 7, 2019
bors added a commit that referenced this issue Aug 7, 2019
@bors bors closed this as completed in #7221 Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants