]> git.lizzy.rs Git - rust.git/commitdiff
Reorder some types.
authorNicholas Nethercote <n.nethercote@gmail.com>
Thu, 24 Nov 2022 22:59:36 +0000 (09:59 +1100)
committerNicholas Nethercote <n.nethercote@gmail.com>
Tue, 29 Nov 2022 01:10:34 +0000 (12:10 +1100)
So that `Attribute` and `MetaItem` are listed first, and then the
component types are below them in a logical order.

compiler/rustc_ast/src/ast.rs

index 9d23bb5c1596accc7368e5078e99675a7e85fe74..6a2f1f0c5749c8be36891cbcbb1b1322b517102f 100644 (file)
@@ -479,20 +479,6 @@ pub struct Crate {
     pub is_placeholder: bool,
 }
 
-/// Values inside meta item lists.
-///
-/// E.g., each of `Clone`, `Copy` in `#[derive(Clone, Copy)]`.
-#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
-pub enum NestedMetaItem {
-    /// A full MetaItem, for recursive meta items.
-    MetaItem(MetaItem),
-
-    /// A literal.
-    ///
-    /// E.g., `"foo"`, `64`, `true`.
-    Lit(MetaItemLit),
-}
-
 /// A semantic representation of a meta item. A meta item is a slightly
 /// restricted form of an attribute -- it can only contain expressions in
 /// certain leaf positions, rather than arbitrary token streams -- that is used
@@ -525,6 +511,20 @@ pub enum MetaItemKind {
     NameValue(MetaItemLit),
 }
 
+/// Values inside meta item lists.
+///
+/// E.g., each of `Clone`, `Copy` in `#[derive(Clone, Copy)]`.
+#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
+pub enum NestedMetaItem {
+    /// A full MetaItem, for recursive meta items.
+    MetaItem(MetaItem),
+
+    /// A literal.
+    ///
+    /// E.g., `"foo"`, `64`, `true`.
+    Lit(MetaItemLit),
+}
+
 /// A block (`{ .. }`).
 ///
 /// E.g., `{ .. }` as in `fn foo() { .. }`.
@@ -2574,13 +2574,6 @@ impl<D: Decoder> Decodable<D> for AttrId {
     }
 }
 
-#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
-pub struct AttrItem {
-    pub path: Path,
-    pub args: AttrArgs,
-    pub tokens: Option<LazyAttrTokenStream>,
-}
-
 /// A list of attributes.
 pub type AttrVec = ThinVec<Attribute>;
 
@@ -2595,12 +2588,6 @@ pub struct Attribute {
     pub span: Span,
 }
 
-#[derive(Clone, Encodable, Decodable, Debug)]
-pub struct NormalAttr {
-    pub item: AttrItem,
-    pub tokens: Option<LazyAttrTokenStream>,
-}
-
 #[derive(Clone, Encodable, Decodable, Debug)]
 pub enum AttrKind {
     /// A normal attribute.
@@ -2612,6 +2599,19 @@ pub enum AttrKind {
     DocComment(CommentKind, Symbol),
 }
 
+#[derive(Clone, Encodable, Decodable, Debug)]
+pub struct NormalAttr {
+    pub item: AttrItem,
+    pub tokens: Option<LazyAttrTokenStream>,
+}
+
+#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
+pub struct AttrItem {
+    pub path: Path,
+    pub args: AttrArgs,
+    pub tokens: Option<LazyAttrTokenStream>,
+}
+
 /// `TraitRef`s appear in impls.
 ///
 /// Resolution maps each `TraitRef`'s `ref_id` to its defining trait; that's all