Rename ast::Lit
as ast::MetaItemLit
.
This commit is contained in:
parent
aa10aad1ac
commit
e4a9150872
18 changed files with 103 additions and 84 deletions
|
@ -13,7 +13,7 @@
|
|||
//! - [`FnDecl`], [`FnHeader`] and [`Param`]: Metadata associated with a function declaration.
|
||||
//! - [`Generics`], [`GenericParam`], [`WhereClause`]: Metadata associated with generic parameters.
|
||||
//! - [`EnumDef`] and [`Variant`]: Enum declaration.
|
||||
//! - [`Lit`] and [`LitKind`]: Literal expressions.
|
||||
//! - [`MetaItemLit`] and [`LitKind`]: Literal expressions.
|
||||
//! - [`MacroDef`], [`MacStmtStyle`], [`MacCall`], [`MacDelimiter`]: Macro definition and invocation.
|
||||
//! - [`Attribute`]: Metadata associated with item.
|
||||
//! - [`UnOp`], [`BinOp`], and [`BinOpKind`]: Unary and binary operators.
|
||||
|
@ -489,7 +489,7 @@ pub enum NestedMetaItem {
|
|||
/// A literal.
|
||||
///
|
||||
/// E.g., `"foo"`, `64`, `true`.
|
||||
Literal(Lit),
|
||||
Literal(MetaItemLit),
|
||||
}
|
||||
|
||||
/// A spanned compile-time attribute item.
|
||||
|
@ -518,7 +518,7 @@ pub enum MetaItemKind {
|
|||
/// Name value meta item.
|
||||
///
|
||||
/// E.g., `feature = "foo"` as in `#[feature = "foo"]`.
|
||||
NameValue(Lit),
|
||||
NameValue(MetaItemLit),
|
||||
}
|
||||
|
||||
/// A block (`{ .. }`).
|
||||
|
@ -1599,12 +1599,12 @@ pub enum AttrArgs {
|
|||
}
|
||||
|
||||
// The RHS of an `AttrArgs::Eq` starts out as an expression. Once macro
|
||||
// expansion is completed, all cases end up either as a literal, which is the
|
||||
// form used after lowering to HIR, or as an error.
|
||||
// expansion is completed, all cases end up either as a meta item literal,
|
||||
// which is the form used after lowering to HIR, or as an error.
|
||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||
pub enum AttrArgsEq {
|
||||
Ast(P<Expr>),
|
||||
Hir(Lit),
|
||||
Hir(MetaItemLit),
|
||||
}
|
||||
|
||||
impl AttrArgs {
|
||||
|
@ -1726,14 +1726,13 @@ pub enum StrStyle {
|
|||
Raw(u8),
|
||||
}
|
||||
|
||||
/// An AST literal.
|
||||
/// A literal in a meta item.
|
||||
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
|
||||
pub struct Lit {
|
||||
pub struct MetaItemLit {
|
||||
/// The original literal token as written in source code.
|
||||
pub token_lit: token::Lit,
|
||||
/// The "semantic" representation of the literal lowered from the original tokens.
|
||||
/// Strings are unescaped, hexadecimal forms are eliminated, etc.
|
||||
/// FIXME: Remove this and only create the semantic representation during lowering to HIR.
|
||||
pub kind: LitKind,
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -1783,6 +1782,8 @@ pub enum LitFloatType {
|
|||
Unsuffixed,
|
||||
}
|
||||
|
||||
/// This type is used within both `ast::MetaItemLit` and `hir::Lit`.
|
||||
///
|
||||
/// Note that the entire literal (including the suffix) is considered when
|
||||
/// deciding the `LitKind`. This means that float literals like `1f32` are
|
||||
/// classified by this type as `Float`. This is different to `token::LitKind`
|
||||
|
@ -3096,9 +3097,9 @@ mod size_asserts {
|
|||
static_assert_size!(Impl, 184);
|
||||
static_assert_size!(Item, 184);
|
||||
static_assert_size!(ItemKind, 112);
|
||||
static_assert_size!(Lit, 48);
|
||||
static_assert_size!(LitKind, 24);
|
||||
static_assert_size!(Local, 72);
|
||||
static_assert_size!(MetaItemLit, 48);
|
||||
static_assert_size!(Param, 40);
|
||||
static_assert_size!(Pat, 88);
|
||||
static_assert_size!(Path, 24);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue