Skip to content

ICE with wrap_comments = true #6660

@DaniPopes

Description

@DaniPopes

src/lib.rs:

// > >= >> >>= >>> >>>=

rustfmt.toml:

wrap_comments = true
thread 'main' panicked at src/tools/rustfmt/src/comment.rs:503:29:
byte index 24 is out of bounds of `> >= >> >>= >>> >>>=`
stack backtrace:
   0:     0x7fb5f437f665 - std::backtrace::Backtrace::create::h0ebef07d66fbcad4
   1:     0x7fb5f437f5b5 - std::backtrace::Backtrace::force_capture::h22eb8a20ad20ae64
   2:     0x7fb5f33c9072 - std[1ae240f8297d0d6c]::panicking::update_hook::<alloc[73dd91e0cc1c5a1a]::boxed::Box<rustc_driver_impl[78e3243580736ecc]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7fb5f438058f - std::panicking::panic_with_hook::h61973874e117c0ff
   4:     0x7fb5f438034a - std::panicking::panic_handler::{{closure}}::h36a6fb0038e5da7f
   5:     0x7fb5f437a359 - std::sys::backtrace::__rust_end_short_backtrace::h1d93851e041118c6
   6:     0x7fb5f435ab4d - __rustc[7cda223a5263d337]::rust_begin_unwind
   7:     0x7fb5f0ac41b0 - core::panicking::panic_fmt::hcbd1e8cc2091fa74
   8:     0x7fb5f2dbaab0 - core::str::slice_error_fail_rt::h216c8f3ea0132196
   9:     0x7fb5f2cde3ca - core::str::slice_error_fail::h6f4cd551313d4b3b
  10:     0x56043d49f3da - rustfmt_nightly[65f2de9475ee7110]::comment::rewrite_comment_inner
  11:     0x56043d49ab28 - rustfmt_nightly[65f2de9475ee7110]::comment::identify_comment
  12:     0x56043d4556ee - <rustfmt_nightly[65f2de9475ee7110]::visitor::FmtVisitor>::process_comment
  13:     0x56043d4570bc - <rustfmt_nightly[65f2de9475ee7110]::visitor::FmtVisitor>::format_missing_indent
  14:     0x56043d38fe6a - <rustfmt_nightly[65f2de9475ee7110]::Session<std[1ae240f8297d0d6c]::io::stdio::Stdout>>::format_input_inner::{closure#0}
  15:     0x56043d380a24 - rustfmt[c373d0c747d1a2cf]::format_and_emit_report::<std[1ae240f8297d0d6c]::io::stdio::Stdout>
  16:     0x56043d396f55 - rustfmt[c373d0c747d1a2cf]::execute
  17:     0x56043d391e02 - rustfmt[c373d0c747d1a2cf]::main
  18:     0x56043d38c963 - std[1ae240f8297d0d6c]::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  19:     0x56043d38cf19 - std[1ae240f8297d0d6c]::rt::lang_start::<()>::{closure#0}
  20:     0x7fb5f5c13625 - std::rt::lang_start_internal::ha11db31f5200e8bc
  21:     0x56043d3a2638 - main
  22:     0x7fb5ef427675 - <unknown>
  23:     0x7fb5ef427729 - __libc_start_main
  24:     0x56043d267db9 - <unknown>
  25:                0x0 - <unknown>


rustc version: 1.91.0-nightly (5eda692e7 2025-09-11)
platform: x86_64-unknown-linux-gnu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions