Add span-preserving ToTokens for Derive
diff --git a/syntax/tokens.rs b/syntax/tokens.rs
index 29899a9..377fd4c 100644
--- a/syntax/tokens.rs
+++ b/syntax/tokens.rs
@@ -1,7 +1,7 @@
use crate::syntax::atom::Atom::*;
use crate::syntax::{
- Array, Atom, Enum, ExternFn, ExternType, Impl, Receiver, Ref, ResolvableName, Signature,
- SliceRef, Struct, Ty1, Type, TypeAlias, Var,
+ Array, Atom, Derive, Enum, ExternFn, ExternType, Impl, Receiver, Ref, ResolvableName,
+ Signature, SliceRef, Struct, Ty1, Type, TypeAlias, Var,
};
use proc_macro2::{Ident, Span, TokenStream};
use quote::{quote_spanned, ToTokens};
@@ -99,6 +99,12 @@
}
}
+impl ToTokens for Derive {
+ fn to_tokens(&self, tokens: &mut TokenStream) {
+ Ident::new(self.what.as_ref(), self.span).to_tokens(tokens);
+ }
+}
+
impl ToTokens for ExternType {
fn to_tokens(&self, tokens: &mut TokenStream) {
// Notional token range for error reporting purposes.