Long string literals indented using hard tabs with error_on_line_overflow enabled result in ICE.
Code
fn overlong_string() {
"string string string string string string string string string string string string string string string string string string";
}
Configuration
unstable_features = true
hard_tabs = true
error_on_unformatted = true
error_on_line_overflow = true
Reproduction Steps
- Create a project with the above rustfmt.toml and MRE source, ensuring to use hard tabs
- Run
cargo fmt
- ICE!
Meta
rustfmt --version:
1.100.0-nightly (17fd5b8a3 2026-08-28) running on x86_64-unknown-linux-gnu
Error output
thread 'main' (2361) panicked at /rust/deps/annotate-snippets-0.11.5/src/renderer/display_list.rs:1306:9:
SourceAnnotation range `100..110` is beyond the end of buffer `98`
Backtrace
stack backtrace:
0: 0x7fd56eea3126 - <<std[206309b28d9a07bf]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[6e7e658899e916bc]::fmt::Display>::fmt
1: 0x7fd56f60ba0f - core[6e7e658899e916bc]::fmt::write
2: 0x7fd56eeb837c - <std[206309b28d9a07bf]::sys::stdio::unix::Stderr as core[6e7e658899e916bc]::io::write::Write>::write_fmt
3: 0x7fd56ee75bca - std[206309b28d9a07bf]::panicking::default_hook::{closure#0}
4: 0x7fd56ee97383 - std[206309b28d9a07bf]::panicking::default_hook
5: 0x7fd56ddf935f - std[206309b28d9a07bf]::panicking::update_hook::<alloc[7f8ce9961dceb534]::boxed::Box<rustc_driver_impl[59491c9177dec8b9]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7fd56ee97822 - std[206309b28d9a07bf]::panicking::panic_with_hook
7: 0x7fd56ee75c82 - std[206309b28d9a07bf]::panicking::panic_handler::{closure#0}
8: 0x7fd56ee6caf9 - std[206309b28d9a07bf]::sys::backtrace::__rust_end_short_backtrace::<std[206309b28d9a07bf]::panicking::panic_handler::{closure#0}, !>
9: 0x7fd56ee775ad - __rustc[b7adba31e7493c49]::rust_begin_unwind
10: 0x7fd56bba6c8c - core[6e7e658899e916bc]::panicking::panic_fmt
11: 0x55c13cc6ede4 - annotate_snippets[b6d62cd1aae95554]::renderer::display_list::format_snippet
12: 0x55c13cc6c455 - annotate_snippets[b6d62cd1aae95554]::renderer::display_list::format_message
13: 0x55c13ce99fdc - <rustfmt_nightly[78fd72282a29d759]::format_report_formatter::FormatReportFormatter as core[6e7e658899e916bc]::fmt::Display>::fmt
14: 0x7fd56f60ba0f - core[6e7e658899e916bc]::fmt::write
15: 0x7fd56eeb572d - <&std[206309b28d9a07bf]::io::stdio::Stderr as core[6e7e658899e916bc]::io::write::Write>::write_fmt
16: 0x7fd56ee97fa0 - std[206309b28d9a07bf]::io::stdio::_eprint
17: 0x55c13cd39865 - rustfmt[c09bf2a254247d5]::format_and_emit_report::<std[206309b28d9a07bf]::io::stdio::Stdout>
18: 0x55c13cd4ecee - rustfmt[c09bf2a254247d5]::execute
19: 0x55c13cd4a08a - rustfmt[c09bf2a254247d5]::main
20: 0x55c13cd4833b - std[206309b28d9a07bf]::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
21: 0x55c13cd48b39 - std[206309b28d9a07bf]::rt::lang_start::<()>::{closure#0}
22: 0x7fd570a0794c - std[206309b28d9a07bf]::rt::lang_start_internal
23: 0x55c13cd59188 - main
24: 0x7fd569a2a1ca - <unknown>
25: 0x7fd569a2a28b - __libc_start_main
26: 0x55c13cc36509 - <unknown>
27: 0x0 - <unknown>
error: the compiler unexpectedly panicked. This is a bug
thanks @ValShaped for cutting down the example.
Long string literals indented using hard tabs with
error_on_line_overflowenabled result in ICE.Code
Configuration
Reproduction Steps
cargo fmtMeta
rustfmt --version:Error output
Backtrace
thanks @ValShaped for cutting down the example.