Skip to content

rustfmt nightly panics when trying to format a macro #6632

@klefevre

Description

@klefevre

Hi,

This macro makes rustfmt nightly crash:

macro_rules! impl_routes_and_health { ($($feature:literal, $variant:ident),* $(,)?) => { impl EitherState { pub(crate) fn service_name(&self) -> &'static str { match self {	$(	#[cfg(feature = $feature)] Self::$variant(s) => s.service_name(),// BuildService::service_name(s.clone()), )* } } } }; }

If i remove the trailing comment // BuildService::service_name(s.clone()),, it works as expected.

rustc-ice-2025-08-14T09_52_33-31225.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: macros (procedural macros, macro_rules! macros, etc.)C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions