From ee7593e0ac83a1b18e7489b852952cd21e2a6947 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Fri, 24 May 2019 15:17:32 -0700 Subject: Revert changes that belong to separate PR --- src/libsyntax/config.rs | 13 +------------ src/libsyntax/ext/derive.rs | 7 ++----- src/libsyntax/parse/diagnostics.rs | 2 +- 3 files changed, 4 insertions(+), 18 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 5ccec05dda2..c82936afa3d 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -94,17 +94,6 @@ impl<'a> StripUnconfigured<'a> { if !attr.check_name(sym::cfg_attr) { return vec![attr]; } - if attr.tokens.len() == 0 { - self.sess.span_diagnostic.struct_span_err(attr.span, "bad `cfg_attr` attribute") - .span_label(attr.span, "missing condition and attribute") - .note("`cfg_attr` must be of the form: \ - `#[cfg_attr(condition, attribute, other_attribute, ...)]`") - .note("for more information, visit \ - ") - .emit(); - return vec![]; - } let (cfg_predicate, expanded_attrs) = match attr.parse(self.sess, |parser| { parser.expect(&token::OpenDelim(token::Paren))?; @@ -128,7 +117,7 @@ impl<'a> StripUnconfigured<'a> { Ok(result) => result, Err(mut e) => { e.emit(); - return vec![]; + return Vec::new(); } }; diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs index bbdda4932f1..6e789c4c708 100644 --- a/src/libsyntax/ext/derive.rs +++ b/src/libsyntax/ext/derive.rs @@ -17,11 +17,8 @@ pub fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec) -> return true; } if !attr.is_meta_item_list() { - cx.struct_span_err(attr.span, "bad `derive` attribute") - .span_label(attr.span, "missing traits to be derived") - .note("`derive` must be of the form: \ - `#[derive(Trait1, Trait2, ...)]`") - .emit(); + cx.span_err(attr.span, + "attribute must be of the form `#[derive(Trait1, Trait2, ...)]`"); return false; } diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index e93c0bdb833..810acc9cc92 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -618,7 +618,7 @@ impl<'a> Parser<'a> { let (span, msg) = match (&self.token, self.subparser_name) { (&token::Token::Eof, Some(origin)) => { let sp = self.sess.source_map().next_point(self.span); - (sp, format!( "expected expression, found end of {}", origin)) + (sp, format!("expected expression, found end of {}", origin)) } _ => (self.span, format!( "expected expression, found {}", -- cgit 1.4.1-3-g733a5