Merge #2438
2438: Derive Hash for tt::TokenTree r=matklad a=edwin0cheng Preparation for intern `TokenTree` to salsa database Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
2702fa1c5d
@ -33,14 +33,14 @@ impl TokenId {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum TokenTree {
|
pub enum TokenTree {
|
||||||
Leaf(Leaf),
|
Leaf(Leaf),
|
||||||
Subtree(Subtree),
|
Subtree(Subtree),
|
||||||
}
|
}
|
||||||
impl_froms!(TokenTree: Leaf, Subtree);
|
impl_froms!(TokenTree: Leaf, Subtree);
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum Leaf {
|
pub enum Leaf {
|
||||||
Literal(Literal),
|
Literal(Literal),
|
||||||
Punct(Punct),
|
Punct(Punct),
|
||||||
@ -48,13 +48,13 @@ pub enum Leaf {
|
|||||||
}
|
}
|
||||||
impl_froms!(Leaf: Literal, Punct, Ident);
|
impl_froms!(Leaf: Literal, Punct, Ident);
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct Subtree {
|
pub struct Subtree {
|
||||||
pub delimiter: Delimiter,
|
pub delimiter: Delimiter,
|
||||||
pub token_trees: Vec<TokenTree>,
|
pub token_trees: Vec<TokenTree>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
pub enum Delimiter {
|
pub enum Delimiter {
|
||||||
Parenthesis,
|
Parenthesis,
|
||||||
Brace,
|
Brace,
|
||||||
@ -62,24 +62,24 @@ pub enum Delimiter {
|
|||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct Literal {
|
pub struct Literal {
|
||||||
pub text: SmolStr,
|
pub text: SmolStr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct Punct {
|
pub struct Punct {
|
||||||
pub char: char,
|
pub char: char,
|
||||||
pub spacing: Spacing,
|
pub spacing: Spacing,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum Spacing {
|
pub enum Spacing {
|
||||||
Alone,
|
Alone,
|
||||||
Joint,
|
Joint,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct Ident {
|
pub struct Ident {
|
||||||
pub text: SmolStr,
|
pub text: SmolStr,
|
||||||
pub id: TokenId,
|
pub id: TokenId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user