@@ -1751,7 +1751,8 @@ pub enum LitFloatType {
1751
1751
/// E.g., `"foo"`, `42`, `12.34`, or `bool`.
1752
1752
#[ derive( Clone , Encodable , Decodable , Debug , Hash , Eq , PartialEq , HashStable_Generic ) ]
1753
1753
pub 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.
1755
1756
Str ( Symbol , StrStyle ) ,
1756
1757
/// A byte string (`b"foo"`).
1757
1758
ByteStr ( Lrc < [ u8 ] > ) ,
@@ -1761,12 +1762,13 @@ pub enum LitKind {
1761
1762
Char ( char ) ,
1762
1763
/// An integer literal (`1`).
1763
1764
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`.
1765
1767
Float ( Symbol , LitFloatType ) ,
1766
1768
/// A boolean literal.
1767
1769
Bool ( bool ) ,
1768
1770
/// Placeholder for a literal that wasn't well-formed in some way.
1769
- Err ( Symbol ) ,
1771
+ Err ,
1770
1772
}
1771
1773
1772
1774
impl LitKind {
@@ -1805,7 +1807,7 @@ impl LitKind {
1805
1807
| LitKind :: Int ( _, LitIntType :: Unsuffixed )
1806
1808
| LitKind :: Float ( _, LitFloatType :: Unsuffixed )
1807
1809
| LitKind :: Bool ( ..)
1808
- | LitKind :: Err ( .. ) => false ,
1810
+ | LitKind :: Err => false ,
1809
1811
}
1810
1812
}
1811
1813
}
0 commit comments