Support if-let guards in matches macros by using :guard matcher#156025
Support if-let guards in matches macros by using :guard matcher#156025SpriteOvO wants to merge 2 commits into
matches macros by using :guard matcher#156025Conversation
Alternatively, to be more safe, we only provide the |
|
Hi - could you provide us some examples of where this might be a breaking change? We discussed this in the libs-api meeting but it wasn't quite clear what this might affect |
|
rust/compiler/rustc_expand/src/mbe/macro_rules.rs Lines 1716 to 1725 in 9128490 @nia-e My main concern was in
I took some time to rethink it, given that the original intent of this matcher was just to simplify matching match-guards, rather than to allow users to extend the syntax with custom rules. And strictly according to The requested Crater run was also based on the potential impacts mentioned above, plus, it’s instantly stable. If we decide to remove |
Tracking issue #153104.
This PR replaces the original
if $guard:exprwith new matcher$guard:guardin macrosmatches!andassert_matches!to support the use of if-let guards syntax in these macros. This syntax is already stable in #141295 formatcharms.Please note that this PR directly applies
:guardto macros that are already stable, so the support for if-let guards in these macros is instantly stable.When using these macros that accept
:guard, users will not be required to use nightly and enable#![feature(macro_guard_matcher)]. However, when defining macros with:guard, nightly and#![feature(macro_guard_matcher)]are still required. Therefore, I think a Crater run is needed.cc @programmerjake
r? libs