Attach TokenStream to ast::Visibility

A `Visibility` does not have outer attributes, so we only capture tokens
when parsing a `macro_rules!` matcher
This commit is contained in:
Aaron Hill 2020-08-21 19:11:00 -04:00
parent 55082ce413
commit c1011165e6
No known key found for this signature in database
GPG key ID: B4087E510E98B164
22 changed files with 120 additions and 50 deletions

View file

@ -98,7 +98,7 @@ pub fn inject(
impl<'a> CollectProcMacros<'a> {
fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) {
if self.is_proc_macro_crate && self.in_root && vis.node.is_pub() {
if self.is_proc_macro_crate && self.in_root && vis.kind.is_pub() {
self.handler.span_err(
sp,
"`proc-macro` crate types currently cannot export any items other \
@ -184,7 +184,7 @@ impl<'a> CollectProcMacros<'a> {
Vec::new()
};
if self.in_root && item.vis.node.is_pub() {
if self.in_root && item.vis.kind.is_pub() {
self.macros.push(ProcMacro::Derive(ProcMacroDerive {
id: item.id,
span: item.span,
@ -204,7 +204,7 @@ impl<'a> CollectProcMacros<'a> {
}
fn collect_attr_proc_macro(&mut self, item: &'a ast::Item) {
if self.in_root && item.vis.node.is_pub() {
if self.in_root && item.vis.kind.is_pub() {
self.macros.push(ProcMacro::Def(ProcMacroDef {
id: item.id,
span: item.span,
@ -223,7 +223,7 @@ impl<'a> CollectProcMacros<'a> {
}
fn collect_bang_proc_macro(&mut self, item: &'a ast::Item) {
if self.in_root && item.vis.node.is_pub() {
if self.in_root && item.vis.kind.is_pub() {
self.macros.push(ProcMacro::Def(ProcMacroDef {
id: item.id,
span: item.span,