mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-03 01:16:14 +03:00
Merge #810
810: make token trees eq r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
@@ -67,7 +67,7 @@ fn expand_vec(self, input: MacroInput) -> Option<MacroExpansion> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct MacroInput {
|
||||
// Should be token trees
|
||||
pub text: String,
|
||||
|
||||
@@ -33,14 +33,14 @@ pub const fn unspecified() -> TokenId {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum TokenTree {
|
||||
Leaf(Leaf),
|
||||
Subtree(Subtree),
|
||||
}
|
||||
impl_froms!(TokenTree: Leaf, Subtree);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Leaf {
|
||||
Literal(Literal),
|
||||
Punct(Punct),
|
||||
@@ -48,7 +48,7 @@ pub enum Leaf {
|
||||
}
|
||||
impl_froms!(Leaf: Literal, Punct, Ident);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Subtree {
|
||||
pub delimiter: Delimiter,
|
||||
pub token_trees: Vec<TokenTree>,
|
||||
@@ -62,7 +62,7 @@ pub enum Delimiter {
|
||||
None,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Literal {
|
||||
pub text: SmolStr,
|
||||
}
|
||||
@@ -79,7 +79,7 @@ pub enum Spacing {
|
||||
Joint,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Ident {
|
||||
pub text: SmolStr,
|
||||
pub id: TokenId,
|
||||
|
||||
Reference in New Issue
Block a user