Revert changes that belong to separate PR
This commit is contained in:
parent
da57ac38a6
commit
ee7593e0ac
@ -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 \
|
||||
<https://doc.rust-lang.org/reference/conditional-compilation.html\
|
||||
#the-cfg_attr-attribute>")
|
||||
.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();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,11 +17,8 @@ pub fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>) ->
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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 {}",
|
||||
|
@ -7,7 +7,7 @@ struct Test2;
|
||||
#[derive()] //~ WARNING empty trait list
|
||||
struct Test3;
|
||||
|
||||
#[derive] //~ ERROR bad `derive` attribute
|
||||
#[derive] //~ ERROR attribute must be of the form `#[derive(Trait1, Trait2, ...)]`
|
||||
struct Test4;
|
||||
|
||||
fn main() {}
|
||||
|
@ -16,13 +16,11 @@ warning: empty trait list in `derive`
|
||||
LL | #[derive()]
|
||||
| ^^^^^^^^^^^
|
||||
|
||||
error: bad `derive` attribute
|
||||
error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]`
|
||||
--> $DIR/malformed-derive-entry.rs:10:1
|
||||
|
|
||||
LL | #[derive]
|
||||
| ^^^^^^^^^ missing traits to be derived
|
||||
|
|
||||
= note: `derive` must be of the form: `#[derive(Trait1, Trait2, ...)]`
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
#[cfg_attr] //~ ERROR bad `cfg_attr` attribute
|
||||
#[cfg_attr] //~ ERROR expected `(`, found end of attribute
|
||||
struct S1;
|
||||
|
||||
#[cfg_attr = ""] //~ ERROR expected `(`, found `=`
|
||||
struct S2;
|
||||
|
||||
#[derive] //~ ERROR bad `derive` attribute
|
||||
#[derive] //~ ERROR attribute must be of the form
|
||||
struct S3;
|
||||
|
||||
#[derive = ""] //~ ERROR bad `derive` attribute
|
||||
#[derive = ""] //~ ERROR attribute must be of the form
|
||||
struct S4;
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,11 +1,8 @@
|
||||
error: bad `cfg_attr` attribute
|
||||
error: expected `(`, found end of attribute
|
||||
--> $DIR/malformed-special-attrs.rs:1:1
|
||||
|
|
||||
LL | #[cfg_attr]
|
||||
| ^^^^^^^^^^^ missing condition and attribute
|
||||
|
|
||||
= note: `cfg_attr` must be of the form: `#[cfg_attr(condition, attribute, other_attribute, ...)]`
|
||||
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
|
||||
| ^ expected `(`
|
||||
|
||||
error: expected `(`, found `=`
|
||||
--> $DIR/malformed-special-attrs.rs:4:12
|
||||
@ -13,21 +10,17 @@ error: expected `(`, found `=`
|
||||
LL | #[cfg_attr = ""]
|
||||
| ^ expected `(`
|
||||
|
||||
error: bad `derive` attribute
|
||||
error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]`
|
||||
--> $DIR/malformed-special-attrs.rs:7:1
|
||||
|
|
||||
LL | #[derive]
|
||||
| ^^^^^^^^^ missing traits to be derived
|
||||
|
|
||||
= note: `derive` must be of the form: `#[derive(Trait1, Trait2, ...)]`
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: bad `derive` attribute
|
||||
error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]`
|
||||
--> $DIR/malformed-special-attrs.rs:10:1
|
||||
|
|
||||
LL | #[derive = ""]
|
||||
| ^^^^^^^^^^^^^^ missing traits to be derived
|
||||
|
|
||||
= note: `derive` must be of the form: `#[derive(Trait1, Trait2, ...)]`
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user