Skip to content

Panic formatting m!(,) #2569

@dtolnay

Description

@dtolnay

We use a type-macro Token![,] in Syn to refer to the Rust comma token, which seems to cause trouble for rustfmt-nightly 0.4.1.

m!(,);
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
stack backtrace:
   9: <rustfmt_nightly::lists::ListItems<'a, I, F1, F2, F3> as core::iter::iterator::Iterator>::next
  10: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  11: <rustfmt_nightly::overflow::Context<'a, T>>::rewrite_items
  12: <rustfmt_nightly::overflow::Context<'a, T>>::rewrite
  13: rustfmt_nightly::overflow::rewrite_with_parens
  14: rustfmt_nightly::macros::rewrite_macro
  15: rustfmt_nightly::visitor::FmtVisitor::visit_mac
  16: rustfmt_nightly::visitor::FmtVisitor::visit_item
  17: rustfmt_nightly::reorder::<impl rustfmt_nightly::visitor::FmtVisitor<'a>>::visit_items_with_reordering
  18: rustfmt_nightly::format_input_inner
  19: <scoped_tls::ScopedKey<T>>::set
  20: syntax::with_globals
  21: rustfmt_nightly::run
  22: rustfmt::execute
  23: rustfmt::main

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-macrosbugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions