Fix mbe::Shift::new not accounting for non-ident token ids
This commit is contained in:
parent
0bc3003960
commit
a9c4c6da4c
@ -27,7 +27,7 @@ macro_rules! f {
|
|||||||
f!(struct MyTraitMap2);
|
f!(struct MyTraitMap2);
|
||||||
"#,
|
"#,
|
||||||
expect![[r##"
|
expect![[r##"
|
||||||
// call ids will be shifted by Shift(27)
|
// call ids will be shifted by Shift(30)
|
||||||
// +tokenids
|
// +tokenids
|
||||||
macro_rules! f {#0
|
macro_rules! f {#0
|
||||||
(#1 struct#2 $#3ident#4:#5ident#6 )#1 =#7>#8 {#9
|
(#1 struct#2 $#3ident#4:#5ident#6 )#1 =#7>#8 {#9
|
||||||
@ -39,7 +39,7 @@ macro_rules! f {#0
|
|||||||
|
|
||||||
// // +tokenids
|
// // +tokenids
|
||||||
// f!(struct#1 MyTraitMap2#2);
|
// f!(struct#1 MyTraitMap2#2);
|
||||||
struct#10 MyTraitMap2#29 {#13
|
struct#10 MyTraitMap2#32 {#13
|
||||||
map#14:#15 ::std#18::collections#21::HashSet#24<#25(#26)#26>#27,#28
|
map#14:#15 ::std#18::collections#21::HashSet#24<#25(#26)#26>#27,#28
|
||||||
}#13
|
}#13
|
||||||
"##]],
|
"##]],
|
||||||
|
@ -120,12 +120,15 @@ impl Shift {
|
|||||||
_ => tree_id,
|
_ => tree_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tt::TokenTree::Leaf(tt::Leaf::Ident(ident))
|
tt::TokenTree::Leaf(leaf) => {
|
||||||
if ident.id != tt::TokenId::unspecified() =>
|
let id = match leaf {
|
||||||
{
|
tt::Leaf::Literal(it) => it.id,
|
||||||
Some(ident.id.0)
|
tt::Leaf::Punct(it) => it.id,
|
||||||
|
tt::Leaf::Ident(it) => it.id,
|
||||||
|
};
|
||||||
|
|
||||||
|
(id != tt::TokenId::unspecified()).then(|| id.0)
|
||||||
}
|
}
|
||||||
_ => None,
|
|
||||||
})
|
})
|
||||||
.max()
|
.max()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user