diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 19 | ||||
| -rw-r--r-- | src/libsyntax/attr/mod.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/mut_visit.rs | 3 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index cf54fd2887a..c1458236788 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -338,7 +338,7 @@ pub enum GenericParamKind { pub struct GenericParam { pub id: NodeId, pub ident: Ident, - pub attrs: ThinVec<Attribute>, + pub attrs: AttrVec, pub bounds: GenericBounds, pub is_placeholder: bool, pub kind: GenericParamKind, @@ -599,7 +599,7 @@ pub struct FieldPat { /// The pattern the field is destructured to pub pat: P<Pat>, pub is_shorthand: bool, - pub attrs: ThinVec<Attribute>, + pub attrs: AttrVec, pub id: NodeId, pub span: Span, pub is_placeholder: bool, @@ -911,7 +911,7 @@ pub enum StmtKind { /// Expr with a trailing semi-colon. Semi(P<Expr>), /// Macro. - Mac(P<(Mac, MacStmtStyle, ThinVec<Attribute>)>), + Mac(P<(Mac, MacStmtStyle, AttrVec)>), } #[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)] @@ -936,7 +936,7 @@ pub struct Local { /// Initializer expression to set the value, if any. pub init: Option<P<Expr>>, pub span: Span, - pub attrs: ThinVec<Attribute>, + pub attrs: AttrVec, } /// An arm of a 'match'. @@ -966,7 +966,7 @@ pub struct Arm { /// Access of a named (e.g., `obj.foo`) or unnamed (e.g., `obj.0`) struct field. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Field { - pub attrs: ThinVec<Attribute>, + pub attrs: AttrVec, pub id: NodeId, pub span: Span, pub ident: Ident, @@ -1004,7 +1004,7 @@ pub struct Expr { pub id: NodeId, pub kind: ExprKind, pub span: Span, - pub attrs: ThinVec<Attribute>, + pub attrs: AttrVec, } // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger. @@ -1961,7 +1961,7 @@ pub struct InlineAsm { /// E.g., `bar: usize` as in `fn foo(bar: usize)`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Param { - pub attrs: ThinVec<Attribute>, + pub attrs: AttrVec, pub ty: P<Ty>, pub pat: P<Pat>, pub id: NodeId, @@ -2014,7 +2014,7 @@ impl Param { } /// Builds a `Param` object from `ExplicitSelf`. - pub fn from_self(attrs: ThinVec<Attribute>, eself: ExplicitSelf, eself_ident: Ident) -> Param { + pub fn from_self(attrs: AttrVec, eself: ExplicitSelf, eself_ident: Ident) -> Param { let span = eself.span.to(eself_ident.span); let infer_ty = P(Ty { id: DUMMY_NODE_ID, @@ -2332,6 +2332,9 @@ pub struct AttrItem { pub args: MacArgs, } +/// A list of attributes. +pub type AttrVec = ThinVec<Attribute>; + /// Metadata associated with an item. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Attribute { diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 13a9ed5f215..ae6d50ba083 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -9,7 +9,7 @@ pub use StabilityLevel::*; pub use crate::ast::Attribute; use crate::ast; -use crate::ast::{AttrItem, AttrId, AttrKind, AttrStyle, Name, Ident, Path, PathSegment}; +use crate::ast::{AttrVec, AttrItem, AttrId, AttrKind, AttrStyle, Name, Ident, Path, PathSegment}; use crate::ast::{MacArgs, MacDelimiter, MetaItem, MetaItemKind, NestedMetaItem}; use crate::ast::{Lit, LitKind, Expr, Item, Local, Stmt, StmtKind, GenericParam}; use crate::mut_visit::visit_clobber; @@ -17,7 +17,6 @@ use crate::source_map::{BytePos, Spanned}; use crate::token::{self, Token}; use crate::ptr::P; use crate::symbol::{sym, Symbol}; -use crate::ThinVec; use crate::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use crate::GLOBALS; @@ -665,7 +664,7 @@ impl HasAttrs for Vec<Attribute> { } } -impl HasAttrs for ThinVec<Attribute> { +impl HasAttrs for AttrVec { fn attrs(&self) -> &[Attribute] { self } diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 36173801eae..30fd23ea909 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -24,7 +24,6 @@ pub use errors; use rustc_data_structures::sync::Lock; use rustc_index::bit_set::GrowableBitSet; -pub use rustc_data_structures::thin_vec::ThinVec; use ast::AttrId; use syntax_pos::edition::Edition; diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 2a6cff5971c..1d27f70f5a5 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -11,7 +11,6 @@ use crate::ast::*; use crate::source_map::{Spanned, respan}; use crate::token::{self, Token}; use crate::ptr::P; -use crate::ThinVec; use crate::tokenstream::*; use crate::util::map_in_place::MapInPlace; @@ -337,7 +336,7 @@ pub fn visit_attrs<T: MutVisitor>(attrs: &mut Vec<Attribute>, vis: &mut T) { } // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. -pub fn visit_thin_attrs<T: MutVisitor>(attrs: &mut ThinVec<Attribute>, vis: &mut T) { +pub fn visit_thin_attrs<T: MutVisitor>(attrs: &mut AttrVec, vis: &mut T) { for attr in attrs.iter_mut() { vis.visit_attribute(attr); } |
