rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
5.93k stars 866 forks source link

[BUG] panicked at SourceAnnotation range `(91, 92)` is bigger than source length `69` #6083

Open sinitcin opened 6 months ago

sinitcin commented 6 months ago

Hello guys! I've started a new project, https://github.com/sinitcin/fhe. A few files have enormous comments. Maybe this is why I've got panic.

$ rustc -V
rustc 1.76.0 (07dca489a 2024-02-04)

$ cargo clippy -V
clippy 0.1.76 (07dca48 2024-02-04)

$ cargo fmt
thread 'main' panicked at /rust/deps/annotate-snippets-0.9.1/src/display_list/from_snippet.rs:286:9:
SourceAnnotation range `(91, 92)` is bigger than source length `69`
stack backtrace:
   0:     0x7fc0e98e06f6 - std::backtrace_rs::backtrace::libunwind::trace::hbee8a7973eeb6c93
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fc0e98e06f6 - std::backtrace_rs::backtrace::trace_unsynchronized::hc8ac75eea3aa6899
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc0e98e06f6 - std::sys_common::backtrace::_print_fmt::hc7f3e3b5298b1083
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fc0e98e06f6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb235daedd7c6190
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fc0e9932f40 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
   5:     0x7fc0e9932f40 - core::fmt::write::h3ed6aeaa977c8e45
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fc0e98d453f - std::io::Write::write_fmt::h78b18af5775fedb5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
   7:     0x7fc0e98e04d4 - std::sys_common::backtrace::_print::h5d645a07e0fcfdbb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fc0e98e04d4 - std::sys_common::backtrace::print::h85035a511aafe7a8
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fc0e98e3267 - std::panicking::default_hook::{{closure}}::hcce8cea212785a25
  10:     0x7fc0e98e2fc9 - std::panicking::default_hook::hf5fcb0f213fe709a
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
  11:     0x7fc0e681461c - std[79729d9c385e1623]::panicking::update_hook::<alloc[6df67106ebca92c0]::boxed::Box<rustc_driver_impl[66ed8fdbde15dc6c]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fc0e98e39b6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hbc5ccf4eb663e1e5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2029:9
  13:     0x7fc0e98e39b6 - std::panicking::rust_panic_with_hook::h095fccf1dc9379ee
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:783:13
  14:     0x7fc0e98e3702 - std::panicking::begin_panic_handler::{{closure}}::h032ba12139b353db
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
  15:     0x7fc0e98e0bf6 - std::sys_common::backtrace::__rust_end_short_backtrace::h9259bc2ff8fd0f76
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7fc0e98e3460 - rust_begin_unwind
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
  17:     0x7fc0e992f645 - core::panicking::panic_fmt::h784f20a50eaab275
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
  18:     0x55cc7912a4f5 - <annotate_snippets[264f0e081455836c]::display_list::structs::DisplayList as core[f975038e3cc9791c]::convert::From<annotate_snippets[264f0e081455836c]::snippet::Snippet>>::from
  19:     0x55cc78ff5c32 - <rustfmt_nightly[9b2d04b1e1d23002]::format_report_formatter::FormatReportFormatter as core[f975038e3cc9791c]::fmt::Display>::fmt
  20:     0x7fc0e9932f40 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
  21:     0x7fc0e9932f40 - core::fmt::write::h3ed6aeaa977c8e45
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
  22:     0x7fc0e98d257b - std::io::Write::write_fmt::h72ee497bb9647f55
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
  23:     0x7fc0e98d257b - <&std::io::stdio::Stderr as std::io::Write>::write_fmt::hac7a1b2c36b9ed2f
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:947:9
  24:     0x7fc0e98d2e7a - <std::io::stdio::Stderr as std::io::Write>::write_fmt::he6934fbd32ff1702
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:921:9
  25:     0x7fc0e98d2e7a - std::io::stdio::print_to::hd17c9037442231e7
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:1020:21
  26:     0x7fc0e98d2e7a - std::io::stdio::_eprint::h7bc67d585efd070e
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:1108:5
  27:     0x55cc78eef5ab - rustfmt[c449a577f49ce32d]::format_and_emit_report::<std[79729d9c385e1623]::io::stdio::Stdout>
  28:     0x55cc78eedc5e - rustfmt[c449a577f49ce32d]::execute
  29:     0x55cc78ee94c6 - rustfmt[c449a577f49ce32d]::main
  30:     0x55cc78ed4533 - std[79729d9c385e1623]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  31:     0x55cc78ed6749 - std[79729d9c385e1623]::rt::lang_start::<()>::{closure#0}
  32:     0x7fc0e98c4cb1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h37600b1e5eea4ecd
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
  33:     0x7fc0e98c4cb1 - std::panicking::try::do_call::hb4bda49fa13a0c2b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  34:     0x7fc0e98c4cb1 - std::panicking::try::h8bbf75149211aaaa
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  35:     0x7fc0e98c4cb1 - std::panic::catch_unwind::h8c78ec68ebea34cb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  36:     0x7fc0e98c4cb1 - std::rt::lang_start_internal::{{closure}}::hffdf44a19fd9e220
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
  37:     0x7fc0e98c4cb1 - std::panicking::try::do_call::hcb3194972c74716d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  38:     0x7fc0e98c4cb1 - std::panicking::try::hcdc6892c5f0dba4c
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  39:     0x7fc0e98c4cb1 - std::panic::catch_unwind::h4910beb4573f4776
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  40:     0x7fc0e98c4cb1 - std::rt::lang_start_internal::h6939038e2873596b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
  41:     0x55cc78ef05d5 - main
  42:     0x7fc0e3828150 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  43:     0x7fc0e3828209 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  44:     0x55cc78ec32c9 - <unknown>
  45:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rustfmt/issues/new?labels=bug

note: rustc 1.76.0 (07dca489a 2024-02-04) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
ytmimi commented 6 months ago

@sinitcin thanks for the report. We've got a few SourceAnnotation panics that are all related, so my initial gut feeling is that this is a duplicate, but I'd need some more info to know for sure. What version of rustfmt were you using? Also, can you run cargo fmt -- -v. and post the output. That might give us a better idea of what file rustfmt was reformatting when it panicked!

sinitcin commented 6 months ago

@ytmimi Thank you for the instant reply. Sure. Here we go:

$ cargo fmt --version
rustfmt 1.7.0-stable (07dca48 2024-02-04)

$ cargo fmt -- -v
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/examples/advanced_real_numbers.rs
Spent 0.000 secs in the parsing phase, and 0.000 secs in the formatting phase
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/bigintdyn/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/bigintdyn/mubintvecdyn.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/bigintdyn/transformdyn.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/bigintdyn/ubintdyn.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/bigintfxd/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/bigintntl/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/intnat/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/hal/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/math/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/core/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/errors.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/fhe_schemes.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/gf_context.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/gf_element.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/lib.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/ckkrns/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/constants.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/cryptocontext.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/encoding/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/extras/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/gen_cryptocontext.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/key/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/keyswitch/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/scheme/ckksrns/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/scheme/gen_cryptocontext_parameters.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/scheme/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/schemebase/base_scheme.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/schemebase/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/schemerns/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/pke/tests/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/ring_context.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/ring_element.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/scale_technique.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/serializable.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/vanilla_variant/encoder/encoder.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/vanilla_variant/encoder/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/vanilla_variant/encoder/plain_text.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/vanilla_variant/encrypter/cipher_text.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/vanilla_variant/encrypter/encrypter.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/vanilla_variant/encrypter/mod.rs
Formatting /home/anton/Yandex.Disk/Аспирантура/Семестр 1/Новая тема CKKS - Homomorphic Encryption/fhe/src/vanilla_variant/mod.rs
Spent 0.002 secs in the parsing phase, and 0.004 secs in the formatting phase
thread 'main' panicked at /rust/deps/annotate-snippets-0.9.1/src/display_list/from_snippet.rs:286:9:
SourceAnnotation range `(91, 92)` is bigger than source length `69`
stack backtrace:
   0:     0x7f39bfce06f6 - std::backtrace_rs::backtrace::libunwind::trace::hbee8a7973eeb6c93
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f39bfce06f6 - std::backtrace_rs::backtrace::trace_unsynchronized::hc8ac75eea3aa6899
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f39bfce06f6 - std::sys_common::backtrace::_print_fmt::hc7f3e3b5298b1083
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f39bfce06f6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb235daedd7c6190
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f39bfd32f40 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
   5:     0x7f39bfd32f40 - core::fmt::write::h3ed6aeaa977c8e45
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f39bfcd453f - std::io::Write::write_fmt::h78b18af5775fedb5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
   7:     0x7f39bfce04d4 - std::sys_common::backtrace::_print::h5d645a07e0fcfdbb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f39bfce04d4 - std::sys_common::backtrace::print::h85035a511aafe7a8
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f39bfce3267 - std::panicking::default_hook::{{closure}}::hcce8cea212785a25
  10:     0x7f39bfce2fc9 - std::panicking::default_hook::hf5fcb0f213fe709a
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
  11:     0x7f39bcc1461c - std[79729d9c385e1623]::panicking::update_hook::<alloc[6df67106ebca92c0]::boxed::Box<rustc_driver_impl[66ed8fdbde15dc6c]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f39bfce39b6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hbc5ccf4eb663e1e5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2029:9
  13:     0x7f39bfce39b6 - std::panicking::rust_panic_with_hook::h095fccf1dc9379ee
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:783:13
  14:     0x7f39bfce3702 - std::panicking::begin_panic_handler::{{closure}}::h032ba12139b353db
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
  15:     0x7f39bfce0bf6 - std::sys_common::backtrace::__rust_end_short_backtrace::h9259bc2ff8fd0f76
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f39bfce3460 - rust_begin_unwind
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
  17:     0x7f39bfd2f645 - core::panicking::panic_fmt::h784f20a50eaab275
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
  18:     0x558ae6fae4f5 - <annotate_snippets[264f0e081455836c]::display_list::structs::DisplayList as core[f975038e3cc9791c]::convert::From<annotate_snippets[264f0e081455836c]::snippet::Snippet>>::from
  19:     0x558ae6e79c32 - <rustfmt_nightly[9b2d04b1e1d23002]::format_report_formatter::FormatReportFormatter as core[f975038e3cc9791c]::fmt::Display>::fmt
  20:     0x7f39bfd32f40 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
  21:     0x7f39bfd32f40 - core::fmt::write::h3ed6aeaa977c8e45
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
  22:     0x7f39bfcd257b - std::io::Write::write_fmt::h72ee497bb9647f55
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
  23:     0x7f39bfcd257b - <&std::io::stdio::Stderr as std::io::Write>::write_fmt::hac7a1b2c36b9ed2f
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:947:9
  24:     0x7f39bfcd2e7a - <std::io::stdio::Stderr as std::io::Write>::write_fmt::he6934fbd32ff1702
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:921:9
  25:     0x7f39bfcd2e7a - std::io::stdio::print_to::hd17c9037442231e7
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:1020:21
  26:     0x7f39bfcd2e7a - std::io::stdio::_eprint::h7bc67d585efd070e
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/stdio.rs:1108:5
  27:     0x558ae6d735ab - rustfmt[c449a577f49ce32d]::format_and_emit_report::<std[79729d9c385e1623]::io::stdio::Stdout>
  28:     0x558ae6d71c5e - rustfmt[c449a577f49ce32d]::execute
  29:     0x558ae6d6d4c6 - rustfmt[c449a577f49ce32d]::main
  30:     0x558ae6d58533 - std[79729d9c385e1623]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  31:     0x558ae6d5a749 - std[79729d9c385e1623]::rt::lang_start::<()>::{closure#0}
  32:     0x7f39bfcc4cb1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h37600b1e5eea4ecd
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
  33:     0x7f39bfcc4cb1 - std::panicking::try::do_call::hb4bda49fa13a0c2b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  34:     0x7f39bfcc4cb1 - std::panicking::try::h8bbf75149211aaaa
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  35:     0x7f39bfcc4cb1 - std::panic::catch_unwind::h8c78ec68ebea34cb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  36:     0x7f39bfcc4cb1 - std::rt::lang_start_internal::{{closure}}::hffdf44a19fd9e220
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
  37:     0x7f39bfcc4cb1 - std::panicking::try::do_call::hcb3194972c74716d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  38:     0x7f39bfcc4cb1 - std::panicking::try::hcdc6892c5f0dba4c
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  39:     0x7f39bfcc4cb1 - std::panic::catch_unwind::h4910beb4573f4776
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  40:     0x7f39bfcc4cb1 - std::rt::lang_start_internal::h6939038e2873596b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
  41:     0x558ae6d745d5 - main
  42:     0x7f39b9c28150 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  43:     0x7f39b9c28209 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  44:     0x558ae6d472c9 - <unknown>
  45:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rustfmt/issues/new?labels=bug

note: rustc 1.76.0 (07dca489a 2024-02-04) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

BTW, you can clone my project and debug clippy on it.

MarcusGrass commented 6 months ago

Seems to be a bug caused by rustfmt supplying a byte-index while annotate-snippets expects a char-index, because of the cyrillics they're different, I made a PR for it here https://github.com/rust-lang/rustfmt/pull/6084

ytmimi commented 6 months ago

@MarcusGrass thanks for helping out on this one!

sinitcin commented 5 months ago

Seems to be a bug caused by rustfmt supplying a byte-index while annotate-snippets expects a char-index, because of the cyrillics they're different, I made a PR for it here #6084

Thank you a lot