diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-05-16 09:22:37 +1000 | 
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-02 16:16:49 +1100 | 
| commit | 4d8f7577b5f2f7c72d1e258c07b882d0afcf0956 (patch) | |
| tree | 2d4c4fb9a4c2d22bae55e9f95c96cd665a152a2a /compiler/rustc_ast/src | |
| parent | bb495d6d3e6dae294f08162097bd85f904e9f90b (diff) | |
| download | rust-4d8f7577b5f2f7c72d1e258c07b882d0afcf0956.tar.gz rust-4d8f7577b5f2f7c72d1e258c07b882d0afcf0956.zip | |
Impl `Copy` for `Token` and `TokenKind`.
Diffstat (limited to 'compiler/rustc_ast/src')
| -rw-r--r-- | compiler/rustc_ast/src/token.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_ast/src/tokenstream.rs | 2 | 
2 files changed, 3 insertions, 3 deletions
| diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index de80bb47aff..9d56cc83ac8 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -333,7 +333,7 @@ impl From<IdentIsRaw> for bool { } } -#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] pub enum TokenKind { /* Expression-operator symbols. */ /// `=` @@ -471,7 +471,7 @@ pub enum TokenKind { Eof, } -#[derive(Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] pub struct Token { pub kind: TokenKind, pub span: Span, diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index 3b457303cac..8260842fb87 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -482,7 +482,7 @@ impl TokenStream { Delimiter::Invisible(InvisibleOrigin::FlattenToken), TokenStream::token_alone(token::Lifetime(ident.name, is_raw), ident.span), ), - _ => TokenTree::Token(token.clone(), spacing), + _ => TokenTree::Token(*token, spacing), } } | 
