Skip to content

rustfix: thread 'main' panicked at 'range start index 2 out of range for slice of length 1' #13031

@matthiaskrgr

Description

@matthiaskrgr

take tests/ui/parser/parser-unicode-whitespace.rs and put just a PS / \u{2029} whitespace after the comment block into a new line
clippy-driver lib.rs --force-warn missing-docs --crate-type lib should looke like

warning: missing documentation for the crate
 --> lib.rs:8:3
  |
8 | 

  |   ^
  |
  = note: requested on the command line with `--force-warn missing-docs`

warning: 1 warning emitted

running clippy --fix now will crash rustfix:

cargo clippy --allow-staged --allow-dirty --fix -- --force-warn missing-docs

thread 'main' panicked at 'range start index 2 out of range for slice of length 1', /cargo/registry/src/index.crates.io-6f17d22bba15001f/rustfix-0.6.1/src/lib.rs:141:20
stack backtrace:
   0:     0x56502a50ef71 - std::backtrace_rs::backtrace::libunwind::trace::h6e5b7e23399032cc
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x56502a50ef71 - std::backtrace_rs::backtrace::trace_unsynchronized::h4528c06bee1e0a8b
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x56502a50ef71 - std::sys_common::backtrace::_print_fmt::h8c8479101d563d31
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x56502a50ef71 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf3690daedd46952c
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x56502a5400df - core::fmt::rt::Argument::fmt::h79448537abb02c02
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/fmt/rt.rs:138:9
   5:     0x56502a5400df - core::fmt::write::hb7b70c241601eb54
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/fmt/mod.rs:1094:21
   6:     0x56502a507ea1 - std::io::Write::write_fmt::h2b40bdf00a46cf42
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/io/mod.rs:1712:15
   7:     0x56502a50ed85 - std::sys_common::backtrace::_print::h264fd8ac10e4d719
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x56502a50ed85 - std::sys_common::backtrace::print::h6190a4e08057accf
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x56502a510c87 - std::panicking::default_hook::{{closure}}::h1fcb6a5fbc17c145
  10:     0x56502a510a74 - std::panicking::default_hook::h1d4472ea1534e7eb
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:288:9
  11:     0x56502a511181 - std::panicking::rust_panic_with_hook::h26983c5985cc3d7d
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:691:13
  12:     0x56502a511077 - std::panicking::begin_panic_handler::{{closure}}::ha2e0c760a3aeec26
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:582:13
  13:     0x56502a50f3b6 - std::sys_common::backtrace::__rust_end_short_backtrace::h10932c5965b100e3
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys_common/backtrace.rs:150:18
  14:     0x56502a510de2 - rust_begin_unwind
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:578:5
  15:     0x56502a53cfe3 - core::panicking::panic_fmt::h887dff9b74ed31aa
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/panicking.rs:67:14
  16:     0x56502a542672 - core::slice::index::slice_start_index_len_fail_rt::h655b2be7ed3df820
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/panic.rs:57:9
  17:     0x56502a542672 - core::slice::index::slice_start_index_len_fail::h5637d89a300c3675
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/slice/index.rs:40:9
  18:     0x56502a4863e6 - rustfix[bf429a282f1ffaac]::parse_snippet
  19:     0x565029e32a28 - <alloc[62a5dcc9069c15c8]::vec::Vec<rustfix[bf429a282f1ffaac]::Snippet> as alloc[62a5dcc9069c15c8]::vec::spec_from_iter::SpecFromIter<rustfix[bf429a282f1ffaac]::Snippet, core[7de8eb2b24556be4]::iter::adapters::filter_map::FilterMap<core[7de8eb2b24556be4]::slice::iter::Iter<rustfix[bf429a282f1ffaac]::diagnostics::DiagnosticSpan>, rustfix[bf429a282f1ffaac]::parse_snippet>>>::from_iter
  20:     0x565029d32ef4 - rustfix[bf429a282f1ffaac]::collect_suggestions::<std[bc31d8d7a4b25d9b]::collections::hash::map::RandomState>
  21:     0x565029c36dc1 - cargo[67b0057911ce8866]::ops::fix::fix_exec_rustc
  22:     0x5650298abb74 - cargo[cec98bc332f35279]::main
  23:     0x5650298b4113 - std[bc31d8d7a4b25d9b]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  24:     0x565029897659 - std[bc31d8d7a4b25d9b]::rt::lang_start::<()>::{closure#0}
  25:     0x56502a4fda05 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hf3c2696c4af09a24
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/core/src/ops/function.rs:284:13
  26:     0x56502a4fda05 - std::panicking::try::do_call::h35fcd9e2ea7d75ed
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:485:40
  27:     0x56502a4fda05 - std::panicking::try::h2aa819d484eed4a3
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:449:19
  28:     0x56502a4fda05 - std::panic::catch_unwind::h88b68f7f03b19a64
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panic.rs:140:14
  29:     0x56502a4fda05 - std::rt::lang_start_internal::{{closure}}::h6c9dbaba36fa562b
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/rt.rs:148:48
  30:     0x56502a4fda05 - std::panicking::try::do_call::h00f525945c08322c
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:485:40
  31:     0x56502a4fda05 - std::panicking::try::he78356a61d48c2f8
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panicking.rs:449:19
  32:     0x56502a4fda05 - std::panic::catch_unwind::hfa222a57694fda04
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/panic.rs:140:14
  33:     0x56502a4fda05 - std::rt::lang_start_internal::hb579105ec5175782
                               at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/rt.rs:148:20
  34:     0x5650298b0685 - main
  35:     0x7f0ae0b8b790 - <unknown>
  36:     0x7f0ae0b8b84a - __libc_start_main
  37:     0x56502982e029 - <unknown>
  38:                0x0 - <unknown>
error: could not compile `G` (lib)
warning: build failed, waiting for other jobs to finish...
warning: crate `G` should have a snake case name
  |
  = help: convert the identifier to snake case: `g`
  = note: `#[warn(non_snake_case

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-fixS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions