Skip to content

panic: byte index 48 is not a char boundary; it is inside '\u{2029} #5739

@langston-barrett

Description

@langston-barrett

This is a fuzzer-generated testcase, please feel free to close and/or let me know if it's not helpful!

Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2daf6f1fef79c417c0c9ad35e79d21ad


// compile-flags: -Z dump-mir-spanview=block





thread 'main' panicked at 'byte index 48 is not a char boundary; it is inside '\u{2029}' (bytes 47..50) of `// compile-flags: -Z dump-mir-spanview=block




`', src/tools/rustfmt/src/missed_spans.rs:215:29
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/panicking.rs:577:5
   1: core::panicking::panic_fmt
             at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/core/src/panicking.rs:67:14
   2: core::str::slice_error_fail_rt
   3: core::str::slice_error_fail
             at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/core/src/str/mod.rs:86:9
   4: <rustfmt_nightly::visitor::FmtVisitor>::format_missing_indent
   5: rustfmt_nightly::formatting::format_project::<rustfmt_nightly::Session<std::io::stdio::Stdout>>
   6: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::with::<<rustfmt_nightly::Session<std::io::stdio::Stdout>>::format_input_inner::{closure#0}, core::result::Result<rustfmt_nightly::FormatReport, rustfmt_nightly::ErrorKind>>
   7: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_span::create_session_if_not_set_then<core::result::Result<rustfmt_nightly::FormatReport, rustfmt_nightly::ErrorKind>, <rustfmt_nightly::Session<std::io::stdio::Stdout>>::format_input_inner::{closure#0}>::{closure#0}, core::result::Result<rustfmt_nightly::FormatReport, rustfmt_nightly::ErrorKind>>
   8: <rustfmt_nightly::Session<std::io::stdio::Stdout>>::format
   9: rustfmt::format_and_emit_report::<std::io::stdio::Stdout>
  10: <rustfmt_nightly::Session<std::io::stdio::Stdout>>::override_config::<rustfmt::format::{closure#0}, ()>
  11: rustfmt::execute
  12: rustfmt::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.p-low

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions