Keep allowing invalid metaitem syntax in diagnostic attributes
This commit is contained in:
parent
a1e2cea685
commit
ed6e63092c
4 changed files with 28 additions and 10 deletions
|
|
@ -113,8 +113,9 @@ impl ArgParser {
|
|||
Some(match value {
|
||||
AttrArgs::Empty => Self::NoArgs,
|
||||
AttrArgs::Delimited(args) => {
|
||||
// The arguments of rustc_dummy are not validated if the arguments are delimited
|
||||
if parts == &[sym::rustc_dummy] {
|
||||
// The arguments of rustc_dummy and diagnostic attributes are not validated
|
||||
// if the arguments are delimited
|
||||
if parts == &[sym::rustc_dummy] || parts[0] == sym::diagnostic {
|
||||
return Some(ArgParser::List(MetaItemListParser {
|
||||
sub_parsers: ThinVec::new(),
|
||||
span: args.dspan.entire(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:11:1
|
||||
--> $DIR/does_not_acccept_args.rs:12:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(not_accepted)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -7,16 +7,22 @@ LL | #[diagnostic::do_not_recommend(not_accepted)]
|
|||
= note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
|
||||
|
||||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:15:1
|
||||
--> $DIR/does_not_acccept_args.rs:16:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(not_accepted = "foo")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:19:1
|
||||
--> $DIR/does_not_acccept_args.rs:20:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(not_accepted(42))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: 3 warnings emitted
|
||||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:24:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(x = y + z)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: 4 warnings emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:11:1
|
||||
--> $DIR/does_not_acccept_args.rs:12:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(not_accepted)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -7,16 +7,22 @@ LL | #[diagnostic::do_not_recommend(not_accepted)]
|
|||
= note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
|
||||
|
||||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:15:1
|
||||
--> $DIR/does_not_acccept_args.rs:16:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(not_accepted = "foo")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:19:1
|
||||
--> $DIR/does_not_acccept_args.rs:20:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(not_accepted(42))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: 3 warnings emitted
|
||||
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
--> $DIR/does_not_acccept_args.rs:24:1
|
||||
|
|
||||
LL | #[diagnostic::do_not_recommend(x = y + z)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: 4 warnings emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
trait Foo {}
|
||||
trait Bar {}
|
||||
trait Baz {}
|
||||
trait Boo {}
|
||||
|
||||
#[diagnostic::do_not_recommend(not_accepted)]
|
||||
//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
|
|
@ -20,4 +21,8 @@ impl<T> Bar for T where T: Send {}
|
|||
//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
impl<T> Baz for T where T: Send {}
|
||||
|
||||
#[diagnostic::do_not_recommend(x = y + z)]
|
||||
//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
|
||||
impl<T> Boo for T where T: Send {}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue