Repository navigation
Tracking issue for the matches! macro #65721
Description
Activity
- addedA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-libs-api[DEPRECATED; DO NOT USE][DEPRECATED; DO NOT USE]B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Oct 23, 2019 - addedrequires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
on Oct 24, 2019 This caused a regression in html5ever because the prelude macro becomes ambiguous with a macro that was brought into scope by a glob import: servo/html5ever#402
@rust-lang/lang, could we make that situation not an error? It seems that we could resolve the ambiguity in favor of the glob import since it is "more local" to the rest of the code in the module.
could we make that situation not an error?
For macros (and imports) it's hard to do.
To remove the ambiguity error we need to prove that with any expansion order and any import resolution order
matchesmaterializes from theuse mac::*glob "not later" than from prelude.Otherwise we'll get code that compiles today but not tomorrow depending on random implementation details. (Making e.g. things like this impossible.)
I have a memory of a change made to treat differently during name resolution items that are unstable, so that new standard library addition can (at first) warn instead of error when they conflict with existing code. However I couldn’t find this again. Maybe it was only for traits?
Yeah, that was for method resolution.
Would a similar special case for unstable prelude items make sense?
Reacted by Jonas PlatteThe 1.42 cycle starts soon. Any objection?
@rfcbot fcp merge
Team member @SimonSapin 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!
See this document for info about what commands tagged team members can give me.
5 remaining items
- removedproposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
on Dec 16, 2019 🔔 This is now entering its final comment period, as per the review above. 🔔
- addedfinished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
on Dec 26, 2019 The final comment period, with a disposition to merge, as per the review above, is now complete.
As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.
The RFC will be merged soon.
- removedfinal-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
on Dec 26, 2019 - added a commit that references this issue
on Dec 27, 2019 - added a commit that references this issue
on Dec 27, 2019 How do we feel about giving this the "relnotes" tag?
Already on the stabilized PR: #67659
Reacted by Jon Gjengset@jonhoo I thought
RELEASES.mdlisted all new(ly-stabilized) APIs? I addedrelnotesto the stabilization PR on that basis. That’s what the label is for, right? This is not to say this should necessarily be mentioned in the release blog post.Reacted by Jon Gjengsetdanielhenrymantilla commented
on Mar 6, 2020 ContributorMore actionsCould
matches!be enhanced to also accept a leading|?matches!(expr, | SomeFirstPattern | SomeOtherPattern ... );
This would be consistent with the syntax of Rust accepting it where fallible patterns are accepted:
match expr { | SomeFirstPattern $(=> ...)? | SomeOtherPattern => ... }
- added a commit that references this issue
on Dec 24, 2020 - added a commit that references this issue
on May 6, 2021
#65479 adds this macro to the prelude:
Example usage: