Crash when formatting complex file
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
cargo fmt and cargo rustfmt crash when processing https://github.com/mobiusklein/mzdata/blob/34b2d6feb3201140991fa66b53960ab8141c7ed7/src/io/infer_format.rs. See below for traceback.
Toolchain: stable-x86_64-pc-windows-msvc
Version: rustc 1.76.0 (07dca489a 2024-02-04)
Platform: Windows 10
Supposition
This file specifically started to crash the formatter when I added a few large, complex generic algebraic types, Source and Sink, and another generic-heavy trait to consume them, MassSpectrometryReadWriteProcess.
Traceback:
Details
hread 'main' panicked at src\tools\rustfmt\src\items.rs:547:10: called `Option::unwrap()` on a `None` value stack backtrace: 0: 0x7fffed4822c2 - ::fmt::h7851e041f2b8bcc2 1: 0x7fffed4b4cdd - core::fmt::write::h1642dfca37b49735 2: 0x7fffed478ca1 - ::fmt::h7801514a6fc13a4a 3: 0x7fffed4820ea - std::sys_common::backtrace::lock::h8caaa69a6cc2258b 4: 0x7fffed485529 - std::panicking::default_hook::h67f6260a0bf37eca 5: 0x7fffed4851e5 - std::panicking::default_hook::h67f6260a0bf37eca 6: 0x7ffff1d0fb03 - ::write_fmt 7: 0x7fffed485b43 - std::panicking::rust_panic_with_hook::h870983d929e74e12 8: 0x7fffed4859ab - ::take_box::h971268ed26284d4c 9: 0x7fffed482bc9 - ::fmt::h7851e041f2b8bcc2 10: 0x7fffed4856b2 - rust_begin_unwind 11: 0x7fffed4da447 - core::panicking::panic_fmt::ha5dd7a91f3010b68 12: 0x7fffed4da522 - core::panicking::panic::h61d0277f5e1a7407 13: 0x7ff64a524bde - 14: 0x7ff64a51c2d6 - 15: 0x7ff64a52a2ea - 16: 0x7ff64a4992b8 - 17: 0x7ff64a49fa3b - 18: 0x7ff64a49cf53 - 19: 0x7ff64a497690 - 20: 0x7ff64a482682 - 21: 0x7ff64a4961af - 22: 0x7ff64a4806bf - 23: 0x7ff64a47e5c4 - 24: 0x7ff64a49bcb6 - 25: 0x7ff64a4974dc - 26: 0x7fffed46ae32 - std::rt::lang_start_internal::h68f55995b3e4e811 27: 0x7ff64a4834fc - 28: 0x7ff64a83acbc - 29: 0x7ff8b1ea7344 - BaseThreadInitThunk 30: 0x7ff8b35426b1 - RtlUserThreadStart
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash with cargo fmt or cargo rustfmt on src/io/infer_format.rs from the reported mzdata revision, then inspect src/tools/rustfmt/src/items.rs around line 547 and the supplied traceback. Done means the formatter processes this complex generic file without panicking on the reported Windows toolchain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100