Allow : after pat_param - #162264
Allow : after pat_param#162264coolreader18 wants to merge 2 commits into
: after pat_param#162264Conversation
|
r? @nnethercote rustbot has assigned @nnethercote. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This definitely would need approval from the lang team. cc @rust-lang/lang @rust-lang/lang-advisors |
|
Makes sense to me. Thanks @coolreader18, @nnethercote. @rfcbot fcp merge lang |
|
@traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
|
It's surprising we don't already allow this. Thanks for the PR. @rfcbot reviewed |
As on the tin. Perhaps this requires a more formal decision process, but in my view this is something of a bug. Originally,
pat_paramwas just the bikeshodden name ofpat2015, c.f. #83386 (comment):But if it truly is a matcher for "a pattern you can use for a parameter", there shouldn't be a problem allowing it to be followed by a colon, given that that's kind of the definitional constraint for that grammar. And if, in the distant future, the language decides to separate the name and type of a parameter with something other than a colon, well, that'll need an edition change anyway.
In my opinion, this would resolve #87724: I'd imagine that most-if-not-all use cases for a
patfollowed by a colon are for matching function signatures or let statements, which don't let you use|patterns anyway. But, we get to have our cake and eat it too by still reserving:for future extensions tomatchexpression (pat) patterns. If it ever is desired to makepatmatch the whole$pat : $tysyntax, as mentioned in #87724 (comment), that's something that can be done over an edition boundary and/or just forpatmatchers.