Skip to content

Follow token checking is too restrictive. #21545

Closed

Description

@vadimcn
macro_rules! foo {
    ( $x:ident $(: $y:ident )* ) => ( $x $(: $y )* )
}
<anon>:2:16: 2:30 error: `$x:ident` is followed by a sequence repetition, which is not allowed for `ident` fragments
<anon>:2     ( $x:ident $(: $y:ident )* ) => ( $x $(: $y )* )

The RFC says that ident may be followed by any token, so why repetition of any tokens would be invalid?

Activity

  1. vadimcn commented on Jan 23, 2015

    @vadimcn
    ContributorAuthor

    cc @cmr

  2. emberian commented on Jan 23, 2015

    @emberian
    Contributor

    The follow sets are only for real tokens, not complex NTs. To extend this properly, the algorithm will need to compute the FIRST of the following token to ensure that it is a subset of the FOLLOW set for that token.

  3. vadimcn commented on Jan 24, 2015

    @vadimcn
    ContributorAuthor

    Created PR to amend the RFC.

  4. steveklabnik commented on Feb 2, 2016

    @steveklabnik
    Contributor

    Traige: the RFC was pursued, so closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions