bugfix to macro template generation: exclude Pos on ident from equality (broken by recent commit)
This commit is contained in:
@@ -120,7 +120,7 @@ impl Pattern {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn make_macro_template(&self, macro_args: &[Ident]) -> Pattern {
|
pub fn make_macro_template(&self, macro_args: &[Ident]) -> Pattern {
|
||||||
log::trace!("repplace_macro_args: {:?} with {:?}", self, macro_args);
|
log::trace!("make_macro_template: {:?} with {:?}", self, macro_args);
|
||||||
match self {
|
match self {
|
||||||
&Pattern::BindPattern {
|
&Pattern::BindPattern {
|
||||||
ref var,
|
ref var,
|
||||||
@@ -128,7 +128,7 @@ impl Pattern {
|
|||||||
pos,
|
pos,
|
||||||
..
|
..
|
||||||
} if matches!(&**subpat, &Pattern::Wildcard { .. }) => {
|
} if matches!(&**subpat, &Pattern::Wildcard { .. }) => {
|
||||||
if let Some(i) = macro_args.iter().position(|arg| arg == var) {
|
if let Some(i) = macro_args.iter().position(|arg| arg.0 == var.0) {
|
||||||
Pattern::MacroArg { index: i, pos }
|
Pattern::MacroArg { index: i, pos }
|
||||||
} else {
|
} else {
|
||||||
self.clone()
|
self.clone()
|
||||||
@@ -174,6 +174,7 @@ impl Pattern {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn subst_macro_args(&self, macro_args: &[Pattern]) -> Pattern {
|
pub fn subst_macro_args(&self, macro_args: &[Pattern]) -> Pattern {
|
||||||
|
log::trace!("subst_macro_args: {:?} with {:?}", self, macro_args);
|
||||||
match self {
|
match self {
|
||||||
&Pattern::BindPattern {
|
&Pattern::BindPattern {
|
||||||
ref var,
|
ref var,
|
||||||
|
|||||||
Reference in New Issue
Block a user