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

Crash when formatting complex file #6137

Open
mobiusklein opened this issue Apr 3, 2024 · 5 comments
Open

Crash when formatting complex file #6137

mobiusklein opened this issue Apr 3, 2024 · 5 comments
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@mobiusklein
Copy link

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
@ytmimi ytmimi added the bug Panic, non-idempotency, invalid code, etc. label Apr 3, 2024
@ytmimi
Copy link
Contributor

ytmimi commented Apr 3, 2024

Thanks for the report. This feels like it's related to #5738.

Here's a smaller reproducible test case:

enum MZReaderType<
    D: DeconvolutedCentroidLike + Default + From<DeconvolutedPeak> + BuildFromArrayMap=DeconvolutedPeak
> {}

@iddm

This comment was marked as resolved.

@ytmimi

This comment was marked as resolved.

@iddm

This comment was marked as resolved.

@calebcartwright
Copy link
Member

I'm going to minimize some of these comments as they feel orthogonal to this particular issue, and are representative of issues experienced by a user (@iddm) that have been reported across multiple issues (#2615)

@iddm as I stated on #2615 a new issue would be helpful for discussion. The issue seems to be specific to you/your local environment, if libcore was panicking for everyone everywhere then yes, that'd be quite a high priority issue across a number of tools and teams.

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.
Projects
None yet
Development

No branches or pull requests

4 participants