about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/mbe/macro_parser.rs
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-10-27 21:55:32 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-11-02 21:05:09 +0100
commit39584b153b5f0b86a7efda9bba0a7d2cbe9b56e2 (patch)
treee9999e2e4d6c50b5f0155f255b240f8d01633c4b /compiler/rustc_expand/src/mbe/macro_parser.rs
parent2f8a068cb760d0845e59b39444cb67479b2d2163 (diff)
downloadrust-39584b153b5f0b86a7efda9bba0a7d2cbe9b56e2.tar.gz
rust-39584b153b5f0b86a7efda9bba0a7d2cbe9b56e2.zip
Factor out matching into `try_match_macro`
This moves out the matching part of expansion into a new function. This
function will try to match the macro and return an error if it failed to
match. A tracker can be used to get more information about the matching.
Diffstat (limited to 'compiler/rustc_expand/src/mbe/macro_parser.rs')
-rw-r--r--compiler/rustc_expand/src/mbe/macro_parser.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_parser.rs b/compiler/rustc_expand/src/mbe/macro_parser.rs
index 0402c51247a..d2dbd190c8e 100644
--- a/compiler/rustc_expand/src/mbe/macro_parser.rs
+++ b/compiler/rustc_expand/src/mbe/macro_parser.rs
@@ -277,7 +277,11 @@ pub(crate) enum ParseResult<T> {
 /// A `ParseResult` where the `Success` variant contains a mapping of
 /// `MacroRulesNormalizedIdent`s to `NamedMatch`es. This represents the mapping
 /// of metavars to the token trees they bind to.
-pub(crate) type NamedParseResult = ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>;
+pub(crate) type NamedParseResult = ParseResult<NamedMatches>;
+
+/// Contains a mapping of `MacroRulesNormalizedIdent`s to `NamedMatch`es.
+/// This represents the mapping of metavars to the token trees they bind to.
+pub(crate) type NamedMatches = FxHashMap<MacroRulesNormalizedIdent, NamedMatch>;
 
 /// Count how many metavars declarations are in `matcher`.
 pub(super) fn count_metavar_decls(matcher: &[TokenTree]) -> usize {