Skip to content

Disallow keywords as macro arguments names #68

Closed
@scottmcm

Description

@scottmcm

Proposal

Summary and problem statement

It was recently determined https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/postfix.20macros/near/216030097 that self and if and such are valid as identifiers in macros ($self, $if, etc).

That prevents adding new things like $crate, since there are no reserved identifiers. So it would be nice to treat them like normal identifiers, where keywords are not allowed. And because these are just identifiers, and thus unaffected by alpha-conversion, all expressible macros are still expressible. (And arguably not calling things $if is probably good.)

Motivation, use-cases, and solution sketches

This would just be an edition change for the edition in which the macro is written.

Prioritization

This would need to happen fairly promptly if it were to make it for the 2021 edition.

Links and related work

https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/postfix.20macros/near/216031552

Initial people involved

@joshtriplett

What happens now?

This issue is part of the experimental MCP process described in RFC 2936. Once this issue is filed, a Zulip topic will be opened for discussion, and the lang-team will review open MCPs in its weekly triage meetings. You should receive feedback within a week or two.

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langfinal-comment-periodThe FCP has started, most (if not all) team members are in agreementmajor-changeMajor change proposalto-announceNot yet announced MCP proposals

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions