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

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

Open
langston-barrett opened this issue Apr 6, 2023 · 1 comment · May be fixed by #5741
Open

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

langston-barrett opened this issue Apr 6, 2023 · 1 comment · May be fixed by #5741
Labels
bug Panic, non-idempotency, invalid code, etc. p-low

Comments

@langston-barrett
Copy link

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.
@ytmimi
Copy link
Contributor

ytmimi commented Apr 7, 2023

@langston-barrett Thanks for the report! I think this is helpful 😁

Just so it's a little clearer for anyone else looking at this, the input snippet is:

// compile-flags: -Z dump-mir-spanview=block\n\n\n\u{2029}\n

and we're failing because of the paragraph separator (\u{2029})

@ytmimi ytmimi added bug Panic, non-idempotency, invalid code, etc. p-low labels Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. p-low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants