Skip to content

Commit fb5dc6b

Browse files
committed
Add some useful comments to LitKind.
1 parent 8818b00 commit fb5dc6b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_ast/src/ast.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -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)]
17531753
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.
17551756
Str(Symbol, StrStyle),
17561757
/// A byte string (`b"foo"`).
17571758
ByteStr(Lrc<[u8]>),
@@ -1761,7 +1762,8 @@ 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),

0 commit comments

Comments
 (0)