Skip to content

Speed up mbe matching in heavy recursive cases #7994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/hir_expand/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ fn parse_macro_with_arg(
None => return ExpandResult { value: None, err: result.err },
};

log::debug!("expanded = {}", tt.as_debug_string());

let fragment_kind = to_fragment_kind(db, macro_call_id);

let (parse, rev_token_map) = match mbe::token_tree_to_syntax_node(&tt, fragment_kind) {
Expand Down
4 changes: 2 additions & 2 deletions crates/mbe/src/expander.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mod matcher;
mod transcriber;

use smallvec::SmallVec;
use rustc_hash::FxHashMap;
use syntax::SmolStr;

use crate::{ExpandError, ExpandResult};
Expand Down Expand Up @@ -96,7 +96,7 @@ pub(crate) fn expand_rules(
/// many is not a plain `usize`, but an `&[usize]`.
#[derive(Debug, Default, Clone, PartialEq, Eq)]
struct Bindings {
inner: SmallVec<[(SmolStr, Binding); 4]>,
inner: FxHashMap<SmolStr, Binding>,
}

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down
Loading