Skip to content

Commit fc2a8a0

Browse files
committed
Reorder some types.
So that `Attribute` and `MetaItem` are listed first, and then the component types are below them in a logical order.
1 parent 5a2fd1a commit fc2a8a0

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

compiler/rustc_ast/src/ast.rs

+27-27
Original file line numberDiff line numberDiff line change
@@ -479,20 +479,6 @@ pub struct Crate {
479479
pub is_placeholder: bool,
480480
}
481481

482-
/// Values inside meta item lists.
483-
///
484-
/// E.g., each of `Clone`, `Copy` in `#[derive(Clone, Copy)]`.
485-
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
486-
pub enum NestedMetaItem {
487-
/// A full MetaItem, for recursive meta items.
488-
MetaItem(MetaItem),
489-
490-
/// A literal.
491-
///
492-
/// E.g., `"foo"`, `64`, `true`.
493-
Lit(MetaItemLit),
494-
}
495-
496482
/// A semantic representation of a meta item. A meta item is a slightly
497483
/// restricted form of an attribute -- it can only contain expressions in
498484
/// certain leaf positions, rather than arbitrary token streams -- that is used
@@ -525,6 +511,20 @@ pub enum MetaItemKind {
525511
NameValue(MetaItemLit),
526512
}
527513

514+
/// Values inside meta item lists.
515+
///
516+
/// E.g., each of `Clone`, `Copy` in `#[derive(Clone, Copy)]`.
517+
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
518+
pub enum NestedMetaItem {
519+
/// A full MetaItem, for recursive meta items.
520+
MetaItem(MetaItem),
521+
522+
/// A literal.
523+
///
524+
/// E.g., `"foo"`, `64`, `true`.
525+
Lit(MetaItemLit),
526+
}
527+
528528
/// A block (`{ .. }`).
529529
///
530530
/// E.g., `{ .. }` as in `fn foo() { .. }`.
@@ -2574,13 +2574,6 @@ impl<D: Decoder> Decodable<D> for AttrId {
25742574
}
25752575
}
25762576

2577-
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
2578-
pub struct AttrItem {
2579-
pub path: Path,
2580-
pub args: AttrArgs,
2581-
pub tokens: Option<LazyAttrTokenStream>,
2582-
}
2583-
25842577
/// A list of attributes.
25852578
pub type AttrVec = ThinVec<Attribute>;
25862579

@@ -2595,12 +2588,6 @@ pub struct Attribute {
25952588
pub span: Span,
25962589
}
25972590

2598-
#[derive(Clone, Encodable, Decodable, Debug)]
2599-
pub struct NormalAttr {
2600-
pub item: AttrItem,
2601-
pub tokens: Option<LazyAttrTokenStream>,
2602-
}
2603-
26042591
#[derive(Clone, Encodable, Decodable, Debug)]
26052592
pub enum AttrKind {
26062593
/// A normal attribute.
@@ -2612,6 +2599,19 @@ pub enum AttrKind {
26122599
DocComment(CommentKind, Symbol),
26132600
}
26142601

2602+
#[derive(Clone, Encodable, Decodable, Debug)]
2603+
pub struct NormalAttr {
2604+
pub item: AttrItem,
2605+
pub tokens: Option<LazyAttrTokenStream>,
2606+
}
2607+
2608+
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
2609+
pub struct AttrItem {
2610+
pub path: Path,
2611+
pub args: AttrArgs,
2612+
pub tokens: Option<LazyAttrTokenStream>,
2613+
}
2614+
26152615
/// `TraitRef`s appear in impls.
26162616
///
26172617
/// Resolution maps each `TraitRef`'s `ref_id` to its defining trait; that's all

0 commit comments

Comments
 (0)