Skip to content

Don't accidentally parse MatchNt #22814

Closed
@kmcallister

Description

@kmcallister

This bit of macro from libcore:

( $($name:ident)+) => (
    #[stable(feature = "rust1", since = "1.0.0")]
    impl<$($name: Hash),*> Hash for ($($name,)*) {

was apparently parsing as a MatchNt $name:Hash, which breaks with my fix to #21370.

There's no need to parse MatchNt on a macro RHS, but we don't know we're on a macro RHS when we're parsing a token tree. Probably we should get rid of MatchNt. It's a weird "composite token" and the tokenizer phase is clearly too early to spot it. Rather we can look for the colon and fragment specifier when we parse a LHS TT into matchers.

Nominating 1.0-beta, P-backcompat-lang.

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.P-highHigh priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions