@@ -1751,7 +1751,8 @@ pub enum LitFloatType {
17511751/// E.g., `"foo"`, `42`, `12.34`, or `bool`.
17521752#[ derive( Clone , Encodable , Decodable , Debug , Hash , Eq , PartialEq , HashStable_Generic ) ]
17531753pub enum LitKind {
1754- /// A string literal (`"foo"`).
1754+ /// A string literal (`"foo"`). The symbol is unescaped, and so may differ
1755+ /// from the original token's symbol.
17551756 Str ( Symbol , StrStyle ) ,
17561757 /// A byte string (`b"foo"`).
17571758 ByteStr ( Lrc < [ u8 ] > ) ,
@@ -1761,12 +1762,13 @@ pub enum LitKind {
17611762 Char ( char ) ,
17621763 /// An integer literal (`1`).
17631764 Int ( u128 , LitIntType ) ,
1764- /// A float literal (`1f64` or `1E10f64`).
1765+ /// A float literal (`1f64` or `1E10f64`). Stored as a symbol rather than
1766+ /// `f64` so that `LitKind` can impl `Eq` and `Hash`.
17651767 Float ( Symbol , LitFloatType ) ,
17661768 /// A boolean literal.
17671769 Bool ( bool ) ,
17681770 /// Placeholder for a literal that wasn't well-formed in some way.
1769- Err ( Symbol ) ,
1771+ Err ,
17701772}
17711773
17721774impl LitKind {
@@ -1805,7 +1807,7 @@ impl LitKind {
18051807 | LitKind :: Int ( _, LitIntType :: Unsuffixed )
18061808 | LitKind :: Float ( _, LitFloatType :: Unsuffixed )
18071809 | LitKind :: Bool ( ..)
1808- | LitKind :: Err ( .. ) => false ,
1810+ | LitKind :: Err => false ,
18091811 }
18101812 }
18111813}
0 commit comments