1
Fork 0

syntax: Split ast::Attribute into container and inner parts

This commit is contained in:
Vadim Petrochenkov 2019-08-17 23:55:41 +03:00
parent 22bc9e1d9c
commit 535d4743a4
8 changed files with 39 additions and 27 deletions

View file

@ -2139,18 +2139,28 @@ impl rustc_serialize::Decodable for AttrId {
}
}
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct AttrItem {
pub path: Path,
pub tokens: TokenStream,
}
/// Metadata associated with an item.
/// Doc-comments are promoted to attributes that have `is_sugared_doc = true`.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct Attribute {
pub item: AttrItem,
pub id: AttrId,
pub style: AttrStyle,
pub path: Path,
pub tokens: TokenStream,
pub is_sugared_doc: bool,
pub span: Span,
}
impl std::ops::Deref for Attribute {
type Target = AttrItem;
fn deref(&self) -> &Self::Target { &self.item }
}
/// `TraitRef`s appear in impls.
///
/// Resolution maps each `TraitRef`'s `ref_id` to its defining trait; that's all