diff --git a/src/lib.rs b/src/lib.rs index d0a2cb72..d6195fa2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,7 +35,7 @@ impl ToTokens for TokenTree { } } -impl ToTokens for Vec { +impl<'a, T: ToTokens> ToTokens for &'a [T] { fn to_tokens(&self, cx: &ExtCtxt) -> Vec { self.iter() .flat_map(|t| t.to_tokens(cx).into_iter()) @@ -43,6 +43,13 @@ impl ToTokens for Vec { } } +impl ToTokens for Vec { + fn to_tokens(&self, cx: &ExtCtxt) -> Vec { + let slice: &[T] = self; + slice.to_tokens(cx) + } +} + impl ToTokens for Spanned { fn to_tokens(&self, cx: &ExtCtxt) -> Vec { // FIXME: use the span? @@ -331,9 +338,7 @@ impl_to_tokens! { P } impl_to_tokens! { ast::WhereClause } impl_to_tokens! { P } impl_to_tokens! { ast::Arm } -impl_to_tokens_lifetime! { &'a [P] } impl_to_tokens! { ast::Ty } -impl_to_tokens_lifetime! { &'a [ast::Ty] } impl_to_tokens! { Generics } impl_to_tokens! { P } impl_to_tokens! { P }