@@ -337,10 +337,8 @@ impl From<IdentIsRaw> for bool {
337337 }
338338}
339339
340- // SAFETY: due to the `Clone` impl below, all fields of all variants other than
341- // `Interpolated` must impl `Copy`.
342340#[ derive( PartialEq , Encodable , Decodable , Debug , HashStable_Generic ) ]
343- pub enum TokenKind {
341+ pub enum TokenKind < Nt = Arc < Nonterminal > > {
344342 /* Expression-operator symbols. */
345343 /// `=`
346344 Eq ,
@@ -481,7 +479,7 @@ pub enum TokenKind {
481479 /// The span in the surrounding `Token` is that of the metavariable in the
482480 /// macro's RHS. The span within the Nonterminal is that of the fragment
483481 /// passed to the macro at the call site.
484- Interpolated ( Arc < Nonterminal > ) ,
482+ Interpolated ( Nt ) ,
485483
486484 /// A doc comment token.
487485 /// `Symbol` is the doc comment's data excluding its "quotes" (`///`, `/**`, etc)
@@ -492,6 +490,15 @@ pub enum TokenKind {
492490 Eof ,
493491}
494492
493+ // make sure that everything else in `TokenKind` is actually `Copy`-able, for
494+ // our unsafe use below.
495+ impl Clone for TokenKind < ( ) > {
496+ fn clone ( & self ) -> Self {
497+ * self
498+ }
499+ }
500+ impl Copy for TokenKind < ( ) > { }
501+
495502impl Clone for TokenKind {
496503 fn clone ( & self ) -> Self {
497504 // `TokenKind` would impl `Copy` if it weren't for `Interpolated`. So
0 commit comments