about summary refs log tree commit diff
path: root/src/libsyntax_expand
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-05 14:19:00 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-06 21:17:18 +0100
commit99191c2e717883bfec51b49df0e412a34849fc4a (patch)
tree7e62fb059b7c253c5a29b42df997fd38f4ce7d99 /src/libsyntax_expand
parentcbc9f683125b4eb21eb3137bbd2c5295650eeaa5 (diff)
parse_meta: ditch parse_in_attr
Diffstat (limited to 'src/libsyntax_expand')
-rw-r--r--src/libsyntax_expand/proc_macro.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax_expand/proc_macro.rs b/src/libsyntax_expand/proc_macro.rs
index ad2281a5879..520488c6586 100644
--- a/src/libsyntax_expand/proc_macro.rs
+++ b/src/libsyntax_expand/proc_macro.rs
@@ -188,14 +188,14 @@ crate fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>)
             Some(x) => x,
         };
 
-        let mut retain_in_fm = true;
-        let mut retain_in_map = true;
+        let mut error_reported_filter_map = false;
+        let mut error_reported_map = false;
         let traits = nmis
             .into_iter()
             // 2) Moreover, let's ensure we have a path and not `#[derive("foo")]`.
             .filter_map(|nmi| match nmi {
                 NestedMetaItem::Literal(lit) => {
-                    retain_in_fm = false;
+                    error_reported_filter_map = true;
                     cx.struct_span_err(lit.span, "expected path to a trait, found literal")
                         .help("for example, write `#[derive(Debug)]` for `Debug`")
                         .emit();
@@ -209,7 +209,7 @@ crate fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>)
             // wanted this trait to be derived, so let's keep it.
             .map(|mi| {
                 let mut traits_dont_accept = |title, action| {
-                    retain_in_map = false;
+                    error_reported_map = true;
                     let sp = mi.span.with_lo(mi.path.span.hi());
                     cx.struct_span_err(sp, title)
                         .span_suggestion(
@@ -235,7 +235,7 @@ crate fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>)
             });
 
         result.extend(traits);
-        retain_in_fm && retain_in_map
+        !error_reported_filter_map && !error_reported_map
     });
     result
 }