Bug 1511811 - Update syn and related dependencies. r=emilio
☠☠ backed out by f713c586d397 ☠ ☠
authorBastien Orivel <eijebong@bananium.fr>
Fri, 30 Nov 2018 12:28:20 +0100
changeset 508462 29c8ec1559a4b87fab322016d03d76262ac42571
parent 508461 f5851346109d87c59d7389d3b8b25f2c02bd7d08
child 508463 ddd573878432219c10221750858afb4688f9da3b
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1511811
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511811 - Update syn and related dependencies. r=emilio
servo/components/malloc_size_of_derive/Cargo.toml
servo/components/malloc_size_of_derive/lib.rs
servo/components/style/Cargo.toml
servo/components/style_derive/Cargo.toml
servo/components/style_derive/animate.rs
servo/components/style_derive/cg.rs
servo/components/style_derive/compute_squared_distance.rs
servo/components/style_derive/lib.rs
servo/components/style_derive/parse.rs
servo/components/style_derive/specified_value_info.rs
servo/components/style_derive/to_animated_value.rs
servo/components/style_derive/to_animated_zero.rs
servo/components/style_derive/to_computed_value.rs
servo/components/style_derive/to_css.rs
--- a/servo/components/malloc_size_of_derive/Cargo.toml
+++ b/servo/components/malloc_size_of_derive/Cargo.toml
@@ -5,11 +5,11 @@ authors = ["The Servo Project Developers
 license = "MIT/Apache-2.0"
 publish = false
 
 [lib]
 path = "lib.rs"
 proc-macro = true
 
 [dependencies]
-quote = "0.5.1"
-syn = { version = "0.13.1", features = ["full"] }
-synstructure = "0.8"
+proc-macro2 = "0.4"
+syn = { version = "0.15", features = ["full"] }
+synstructure = "0.10"
--- a/servo/components/malloc_size_of_derive/lib.rs
+++ b/servo/components/malloc_size_of_derive/lib.rs
@@ -5,26 +5,26 @@
 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
 //! A crate for deriving the MallocSizeOf trait.
 
-extern crate quote;
+extern crate proc_macro2;
 #[macro_use]
 extern crate syn;
 #[macro_use]
 extern crate synstructure;
 
 #[cfg(not(test))]
 decl_derive!([MallocSizeOf, attributes(ignore_malloc_size_of)] => malloc_size_of_derive);
 
-fn malloc_size_of_derive(s: synstructure::Structure) -> quote::Tokens {
+fn malloc_size_of_derive(s: synstructure::Structure) -> proc_macro2::TokenStream {
     let match_body = s.each(|binding| {
         let ignore = binding
             .ast()
             .attrs
             .iter()
             .any(|attr| match attr.interpret_meta().unwrap() {
                 syn::Meta::Word(ref ident) | syn::Meta::List(syn::MetaList { ref ident, .. })
                     if ident == "ignore_malloc_size_of" =>
@@ -56,17 +56,17 @@ fn malloc_size_of_derive(s: synstructure
         }
     });
 
     let ast = s.ast();
     let name = &ast.ident;
     let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
     let mut where_clause = where_clause.unwrap_or(&parse_quote!(where)).clone();
     for param in ast.generics.type_params() {
-        let ident = param.ident;
+        let ident = &param.ident;
         where_clause
             .predicates
             .push(parse_quote!(#ident: ::malloc_size_of::MallocSizeOf));
     }
 
     let tokens = quote! {
         impl #impl_generics ::malloc_size_of::MallocSizeOf for #name #ty_generics #where_clause {
             #[inline]
--- a/servo/components/style/Cargo.toml
+++ b/servo/components/style/Cargo.toml
@@ -73,12 +73,12 @@ time = "0.1"
 uluru = "0.3"
 unicode-bidi = "0.3"
 unicode-segmentation = "1.0"
 void = "1.0.2"
 
 [build-dependencies]
 lazy_static = "1"
 log = "0.4"
-bindgen = { version = "0.43", optional = true, default-features = false }
+bindgen = { version = "0.44", optional = true, default-features = false }
 regex = {version = "1.0", optional = true}
 walkdir = "2.1.4"
 toml = {version = "0.4.5", optional = true, default-features = false}
--- a/servo/components/style_derive/Cargo.toml
+++ b/servo/components/style_derive/Cargo.toml
@@ -5,12 +5,13 @@ authors = ["The Servo Project Developers
 license = "MPL-2.0"
 publish = false
 
 [lib]
 path = "lib.rs"
 proc-macro = true
 
 [dependencies]
-darling = "0.4"
-quote = "0.5.1"
-syn = { version = "0.13.1", features = ["visit"] }
-synstructure = "0.8"
+darling = "0.8"
+proc-macro2 = "0.4"
+quote = "0.6"
+syn = { version = "0.15", features = ["visit"] }
+synstructure = "0.10"
--- a/servo/components/style_derive/animate.rs
+++ b/servo/components/style_derive/animate.rs
@@ -1,19 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::cg;
 use darling::util::IdentList;
-use quote::Tokens;
+use proc_macro2::TokenStream;
+use quote::TokenStreamExt;
 use syn::{DeriveInput, Path};
 use synstructure::{Structure, VariantInfo};
 
-pub fn derive(mut input: DeriveInput) -> Tokens {
+pub fn derive(mut input: DeriveInput) -> TokenStream {
     let animation_input_attrs = cg::parse_input_attrs::<AnimationInputAttrs>(&input);
     let no_bound = animation_input_attrs.no_bound.unwrap_or_default();
     let mut where_clause = input.generics.where_clause.take();
     for param in input.generics.type_params() {
         if !no_bound.contains(&param.ident) {
             cg::add_predicate(
                 &mut where_clause,
                 parse_quote!(#param: crate::values::animated::Animate),
@@ -62,17 +63,17 @@ pub fn derive(mut input: DeriveInput) ->
                 match (self, other) {
                     #match_body
                 }
             }
         }
     }
 }
 
-fn derive_variant_arm(variant: &VariantInfo) -> Result<Tokens, ()> {
+fn derive_variant_arm(variant: &VariantInfo) -> Result<TokenStream, ()> {
     let variant_attrs = cg::parse_variant_attrs_from_ast::<AnimationVariantAttrs>(&variant.ast());
     if variant_attrs.error {
         return Err(());
     }
     let (this_pattern, this_info) = cg::ref_pattern(&variant, "this");
     let (other_pattern, other_info) = cg::ref_pattern(&variant, "other");
     let (result_value, result_info) = cg::value(&variant, "result");
     let mut computations = quote!();
--- a/servo/components/style_derive/cg.rs
+++ b/servo/components/style_derive/cg.rs
@@ -1,31 +1,32 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use darling::{FromDeriveInput, FromField, FromVariant};
-use quote::Tokens;
+use proc_macro2::{Span, TokenStream};
+use quote::TokenStreamExt;
 use syn::{self, AngleBracketedGenericArguments, Binding, DeriveInput, Field};
 use syn::{GenericArgument, GenericParam, Ident, Path};
 use syn::{PathArguments, PathSegment, QSelf, Type, TypeArray};
 use syn::{TypeParam, TypeParen, TypePath, TypeSlice, TypeTuple};
 use syn::{Variant, WherePredicate};
 use synstructure::{self, BindStyle, BindingInfo, VariantAst, VariantInfo};
 
 pub fn add_predicate(where_clause: &mut Option<syn::WhereClause>, pred: WherePredicate) {
     where_clause
         .get_or_insert(parse_quote!(where))
         .predicates
         .push(pred);
 }
 
-pub fn fmap_match<F>(input: &DeriveInput, bind_style: BindStyle, mut f: F) -> Tokens
+pub fn fmap_match<F>(input: &DeriveInput, bind_style: BindStyle, mut f: F) -> TokenStream
 where
-    F: FnMut(BindingInfo) -> Tokens,
+    F: FnMut(BindingInfo) -> TokenStream,
 {
     let mut s = synstructure::Structure::new(input);
     s.variants_mut().iter_mut().for_each(|v| {
         v.bind_with(|_| bind_style);
     });
     s.each_variant(|variant| {
         let (mapped, mapped_fields) = value(variant, "mapped");
         let fields_pairs = variant.bindings().into_iter().zip(mapped_fields);
@@ -47,17 +48,17 @@ pub fn fmap_trait_output(input: &DeriveI
                 .generics
                 .params
                 .iter()
                 .map(|arg| match arg {
                     &GenericParam::Lifetime(ref data) => {
                         GenericArgument::Lifetime(data.lifetime.clone())
                     },
                     &GenericParam::Type(ref data) => {
-                        let ident = data.ident;
+                        let ident = &data.ident;
                         GenericArgument::Type(parse_quote!(<#ident as #trait_path>::#trait_output))
                     },
                     ref arg => panic!("arguments {:?} cannot be mapped yet", arg),
                 })
                 .collect(),
             colon2_token: Default::default(),
             gt_token: Default::default(),
             lt_token: Default::default(),
@@ -91,17 +92,17 @@ where
                 .collect(),
             ..inner.clone()
         }),
         Type::Path(TypePath {
             qself: None,
             ref path,
         }) => {
             if let Some(ident) = path_to_ident(path) {
-                if params.iter().any(|param| param.ident == ident) {
+                if params.iter().any(|ref param| &param.ident == ident) {
                     return f(ident);
                 }
             }
             Type::from(TypePath {
                 qself: None,
                 path: map_type_params_in_path(path, params, f),
             })
         },
@@ -204,17 +205,17 @@ where
     }
 }
 
 pub fn parse_variant_attrs_from_ast<A>(variant: &VariantAst) -> A
 where
     A: FromVariant,
 {
     let v = Variant {
-        ident: *variant.ident,
+        ident: variant.ident.clone(),
         attrs: variant.attrs.to_vec(),
         fields: variant.fields.clone(),
         discriminant: variant.discriminant.clone(),
     };
     parse_variant_attrs(&v)
 }
 
 pub fn parse_variant_attrs<A>(variant: &Variant) -> A
@@ -222,30 +223,33 @@ where
     A: FromVariant,
 {
     match A::from_variant(variant) {
         Ok(attrs) => attrs,
         Err(e) => panic!("failed to parse variant attributes: {}", e),
     }
 }
 
-pub fn ref_pattern<'a>(variant: &'a VariantInfo, prefix: &str) -> (Tokens, Vec<BindingInfo<'a>>) {
+pub fn ref_pattern<'a>(
+    variant: &'a VariantInfo,
+    prefix: &str,
+) -> (TokenStream, Vec<BindingInfo<'a>>) {
     let mut v = variant.clone();
     v.bind_with(|_| BindStyle::Ref);
-    v.bindings_mut()
-        .iter_mut()
-        .for_each(|b| b.binding = Ident::from(format!("{}_{}", b.binding, prefix)));
+    v.bindings_mut().iter_mut().for_each(|b| {
+        b.binding = Ident::new(&format!("{}_{}", b.binding, prefix), Span::call_site())
+    });
     (v.pat(), v.bindings().iter().cloned().collect())
 }
 
-pub fn value<'a>(variant: &'a VariantInfo, prefix: &str) -> (Tokens, Vec<BindingInfo<'a>>) {
+pub fn value<'a>(variant: &'a VariantInfo, prefix: &str) -> (TokenStream, Vec<BindingInfo<'a>>) {
     let mut v = variant.clone();
-    v.bindings_mut()
-        .iter_mut()
-        .for_each(|b| b.binding = Ident::from(format!("{}_{}", b.binding, prefix)));
+    v.bindings_mut().iter_mut().for_each(|b| {
+        b.binding = Ident::new(&format!("{}_{}", b.binding, prefix), Span::call_site())
+    });
     v.bind_with(|_| BindStyle::Move);
     (v.pat(), v.bindings().iter().cloned().collect())
 }
 
 /// Transforms "FooBar" to "foo-bar".
 ///
 /// If the first Camel segment is "Moz", "Webkit", or "Servo", the result string
 /// is prepended with "-".
--- a/servo/components/style_derive/compute_squared_distance.rs
+++ b/servo/components/style_derive/compute_squared_distance.rs
@@ -1,19 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
 use crate::cg;
-use quote::Tokens;
+use proc_macro2::TokenStream;
+use quote::TokenStreamExt;
 use syn::{DeriveInput, Path};
 use synstructure;
 
-pub fn derive(mut input: DeriveInput) -> Tokens {
+pub fn derive(mut input: DeriveInput) -> TokenStream {
     let animation_input_attrs = cg::parse_input_attrs::<AnimationInputAttrs>(&input);
     let no_bound = animation_input_attrs.no_bound.unwrap_or_default();
     let mut where_clause = input.generics.where_clause.take();
     for param in input.generics.type_params() {
         if !no_bound.contains(&param.ident) {
             cg::add_predicate(
                 &mut where_clause,
                 parse_quote!(#param: crate::values::distance::ComputeSquaredDistance),
--- a/servo/components/style_derive/lib.rs
+++ b/servo/components/style_derive/lib.rs
@@ -2,16 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #![recursion_limit = "128"]
 
 #[macro_use]
 extern crate darling;
 extern crate proc_macro;
+extern crate proc_macro2;
 #[macro_use]
 extern crate quote;
 #[macro_use]
 extern crate syn;
 extern crate synstructure;
 
 use proc_macro::TokenStream;
 
--- a/servo/components/style_derive/parse.rs
+++ b/servo/components/style_derive/parse.rs
@@ -1,26 +1,26 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::cg;
 use crate::to_css::CssVariantAttrs;
-use quote::Tokens;
+use proc_macro2::TokenStream;
 use syn::{DeriveInput, Path};
 use synstructure;
 
 #[darling(attributes(parse), default)]
 #[derive(Default, FromVariant)]
 pub struct ParseVariantAttrs {
     pub aliases: Option<String>,
     pub condition: Option<Path>,
 }
 
-pub fn derive(input: DeriveInput) -> Tokens {
+pub fn derive(input: DeriveInput) -> TokenStream {
     let name = &input.ident;
     let s = synstructure::Structure::new(&input);
 
     let mut saw_condition = false;
     let match_body = s.variants().iter().fold(quote!(), |match_body, variant| {
         let bindings = variant.bindings();
         assert!(
             bindings.is_empty(),
@@ -31,17 +31,17 @@ pub fn derive(input: DeriveInput) -> Tok
         let parse_attrs = cg::parse_variant_attrs_from_ast::<ParseVariantAttrs>(&variant.ast());
         if css_variant_attrs.skip {
             return match_body;
         }
 
         let identifier = cg::to_css_identifier(
             &css_variant_attrs
                 .keyword
-                .unwrap_or(variant.ast().ident.as_ref().into()),
+                .unwrap_or(variant.ast().ident.to_string()),
         );
         let ident = &variant.ast().ident;
 
         saw_condition |= parse_attrs.condition.is_some();
         let condition = match parse_attrs.condition {
             Some(ref p) => quote! { if #p(context) },
             None => quote!{},
         };
--- a/servo/components/style_derive/specified_value_info.rs
+++ b/servo/components/style_derive/specified_value_info.rs
@@ -1,25 +1,26 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::cg;
 use crate::parse::ParseVariantAttrs;
 use crate::to_css::{CssFieldAttrs, CssInputAttrs, CssVariantAttrs};
-use quote::Tokens;
+use proc_macro2::TokenStream;
+use quote::TokenStreamExt;
 use syn::{Data, DeriveInput, Fields, Ident, Type};
 
-pub fn derive(mut input: DeriveInput) -> Tokens {
+pub fn derive(mut input: DeriveInput) -> TokenStream {
     let css_attrs = cg::parse_input_attrs::<CssInputAttrs>(&input);
     let mut types = vec![];
     let mut values = vec![];
 
-    let input_ident = input.ident;
-    let input_name = || cg::to_css_identifier(input_ident.as_ref());
+    let input_ident = &input.ident;
+    let input_name = || cg::to_css_identifier(&input_ident.to_string());
     if let Some(function) = css_attrs.function {
         values.push(function.explicit().unwrap_or_else(input_name));
     // If the whole value is wrapped in a function, value types of
     // its fields should not be propagated.
     } else {
         let mut where_clause = input.generics.where_clause.take();
         for param in input.generics.type_params() {
             cg::add_predicate(
@@ -44,17 +45,17 @@ pub fn derive(mut input: DeriveInput) ->
                         }
                     }
                     if let Some(other_values) = info_attrs.other_values {
                         for value in other_values.split(",") {
                             values.push(value.to_string());
                         }
                     }
                     let ident = &v.ident;
-                    let variant_name = || cg::to_css_identifier(ident.as_ref());
+                    let variant_name = || cg::to_css_identifier(&ident.to_string());
                     if info_attrs.starts_with_keyword {
                         values.push(variant_name());
                         continue;
                     }
                     if let Some(keyword) = css_attrs.keyword {
                         values.push(keyword);
                         continue;
                     }
@@ -147,17 +148,17 @@ fn derive_struct_fields<'a>(
             }
         }
         let css_attrs = cg::parse_field_attrs::<CssFieldAttrs>(field);
         if css_attrs.represents_keyword {
             let ident = field
                 .ident
                 .as_ref()
                 .expect("only named field should use represents_keyword");
-            values.push(cg::to_css_identifier(ident.as_ref()));
+            values.push(cg::to_css_identifier(&ident.to_string()));
             return None;
         }
         if let Some(if_empty) = css_attrs.if_empty {
             values.push(if_empty);
         }
         if !css_attrs.skip {
             Some(&field.ty)
         } else {
--- a/servo/components/style_derive/to_animated_value.rs
+++ b/servo/components/style_derive/to_animated_value.rs
@@ -1,18 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::cg;
-use quote;
-use syn::DeriveInput;
+use proc_macro2::{Span, TokenStream};
+use syn::{DeriveInput, Ident};
 use synstructure::BindStyle;
 
-pub fn derive(mut input: DeriveInput) -> quote::Tokens {
+pub fn derive(mut input: DeriveInput) -> TokenStream {
     let mut where_clause = input.generics.where_clause.take();
     for param in input.generics.type_params() {
         cg::add_predicate(
             &mut where_clause,
             parse_quote!(#param: crate::values::animated::ToAnimatedValue),
         );
     }
 
@@ -28,17 +28,17 @@ pub fn derive(mut input: DeriveInput) ->
     );
 
     input.generics.where_clause = where_clause;
     let name = &input.ident;
     let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
     let animated_value_type = cg::fmap_trait_output(
         &input,
         &parse_quote!(crate::values::animated::ToAnimatedValue),
-        "AnimatedValue".into(),
+        Ident::new("AnimatedValue", Span::call_site()),
     );
 
     quote! {
         impl #impl_generics crate::values::animated::ToAnimatedValue for #name #ty_generics #where_clause {
             type AnimatedValue = #animated_value_type;
 
             #[allow(unused_variables)]
             #[inline]
--- a/servo/components/style_derive/to_animated_zero.rs
+++ b/servo/components/style_derive/to_animated_zero.rs
@@ -1,19 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
 use crate::cg;
-use quote;
+use proc_macro2::TokenStream;
+use quote::TokenStreamExt;
 use syn;
 use synstructure;
 
-pub fn derive(mut input: syn::DeriveInput) -> quote::Tokens {
+pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
     let animation_input_attrs = cg::parse_input_attrs::<AnimationInputAttrs>(&input);
     let no_bound = animation_input_attrs.no_bound.unwrap_or_default();
     let mut where_clause = input.generics.where_clause.take();
     for param in input.generics.type_params() {
         if !no_bound.contains(&param.ident) {
             cg::add_predicate(
                 &mut where_clause,
                 parse_quote!(#param: crate::values::animated::ToAnimatedZero),
--- a/servo/components/style_derive/to_computed_value.rs
+++ b/servo/components/style_derive/to_computed_value.rs
@@ -1,18 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::cg;
-use quote::Tokens;
-use syn::DeriveInput;
+use proc_macro2::{Span, TokenStream};
+use syn::{DeriveInput, Ident};
 use synstructure::BindStyle;
 
-pub fn derive(mut input: DeriveInput) -> Tokens {
+pub fn derive(mut input: DeriveInput) -> TokenStream {
     let mut where_clause = input.generics.where_clause.take();
     let (to_body, from_body) = {
         let params = input.generics.type_params().collect::<Vec<_>>();
         for param in &params {
             cg::add_predicate(
                 &mut where_clause,
                 parse_quote!(#param: crate::values::computed::ToComputedValue),
             );
@@ -74,17 +74,17 @@ pub fn derive(mut input: DeriveInput) ->
                 }
             }
         };
     }
 
     let computed_value_type = cg::fmap_trait_output(
         &input,
         &parse_quote!(crate::values::computed::ToComputedValue),
-        "ComputedValue".into(),
+        Ident::new("ComputedValue", Span::call_site()),
     );
 
     quote! {
         impl #impl_generics crate::values::computed::ToComputedValue for #name #ty_generics #where_clause {
             type ComputedValue = #computed_value_type;
 
             #[allow(unused_variables)]
             #[inline]
--- a/servo/components/style_derive/to_css.rs
+++ b/servo/components/style_derive/to_css.rs
@@ -1,19 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use crate::cg;
 use darling::util::Override;
-use quote::{ToTokens, Tokens};
+use proc_macro2::TokenStream;
+use quote::{ToTokens, TokenStreamExt};
 use syn::{self, Data, Path, WhereClause};
 use synstructure::{BindingInfo, Structure, VariantInfo};
 
-pub fn derive(mut input: syn::DeriveInput) -> Tokens {
+pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
     let mut where_clause = input.generics.where_clause.take();
     for param in input.generics.type_params() {
         cg::add_predicate(&mut where_clause, parse_quote!(#param: style_traits::ToCss));
     }
 
     let input_attrs = cg::parse_input_attrs::<CssInputAttrs>(&input);
     if let Data::Enum(_) = input.data {
         assert!(
@@ -61,19 +62,19 @@ pub fn derive(mut input: syn::DeriveInpu
                 }
             }
         });
     }
 
     impls
 }
 
-fn derive_variant_arm(variant: &VariantInfo, generics: &mut Option<WhereClause>) -> Tokens {
+fn derive_variant_arm(variant: &VariantInfo, generics: &mut Option<WhereClause>) -> TokenStream {
     let bindings = variant.bindings();
-    let identifier = cg::to_css_identifier(variant.ast().ident.as_ref());
+    let identifier = cg::to_css_identifier(&variant.ast().ident.to_string());
     let ast = variant.ast();
     let variant_attrs = cg::parse_variant_attrs_from_ast::<CssVariantAttrs>(&ast);
     let separator = if variant_attrs.comma { ", " } else { " " };
 
     if variant_attrs.skip {
         return quote!(Ok(()));
     }
     if variant_attrs.dimension {
@@ -113,17 +114,17 @@ fn derive_variant_arm(variant: &VariantI
     }
     expr
 }
 
 fn derive_variant_fields_expr(
     bindings: &[BindingInfo],
     where_clause: &mut Option<WhereClause>,
     separator: &str,
-) -> Tokens {
+) -> TokenStream {
     let mut iter = bindings
         .iter()
         .filter_map(|binding| {
             let attrs = cg::parse_field_attrs::<CssFieldAttrs>(&binding.ast());
             if attrs.skip {
                 return None;
             }
             Some((binding, attrs))
@@ -161,17 +162,17 @@ fn derive_variant_fields_expr(
         Ok(())
     }}
 }
 
 fn derive_single_field_expr(
     field: &BindingInfo,
     attrs: CssFieldAttrs,
     where_clause: &mut Option<WhereClause>,
-) -> Tokens {
+) -> TokenStream {
     let mut expr = if attrs.iterable {
         if let Some(if_empty) = attrs.if_empty {
             return quote! {
                 {
                     let mut iter = #field.iter().peekable();
                     if iter.peek().is_none() {
                         writer.raw_item(#if_empty)?;
                     } else {
@@ -188,17 +189,17 @@ fn derive_single_field_expr(
             }
         }
     } else if attrs.represents_keyword {
         let ident = field
             .ast()
             .ident
             .as_ref()
             .expect("Unnamed field with represents_keyword?");
-        let ident = cg::to_css_identifier(ident.as_ref());
+        let ident = cg::to_css_identifier(&ident.to_string());
         quote! {
             if *#field {
                 writer.raw_item(#ident)?;
             }
         }
     } else {
         if attrs.field_bound {
             let ty = &field.ast().ty;