File tree Expand file tree Collapse file tree 4 files changed +28
-10
lines changed
compiler/rustc_attr_parsing/src
tests/ui/diagnostic_namespace/do_not_recommend Expand file tree Collapse file tree 4 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,9 @@ impl ArgParser {
113113 Some ( match value {
114114 AttrArgs :: Empty => Self :: NoArgs ,
115115 AttrArgs :: Delimited ( args) => {
116- // The arguments of rustc_dummy are not validated if the arguments are delimited
117- if parts == & [ sym:: rustc_dummy] {
116+ // The arguments of rustc_dummy and diagnostic attributes are not validated
117+ // if the arguments are delimited
118+ if parts == & [ sym:: rustc_dummy] || parts[ 0 ] == sym:: diagnostic {
118119 return Some ( ArgParser :: List ( MetaItemListParser {
119120 sub_parsers : ThinVec :: new ( ) ,
120121 span : args. dspan . entire ( ) ,
Original file line number Diff line number Diff line change 11warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
2- --> $DIR/does_not_acccept_args.rs:11 :1
2+ --> $DIR/does_not_acccept_args.rs:12 :1
33 |
44LL | #[diagnostic::do_not_recommend(not_accepted)]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
77 = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
88
99warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
10- --> $DIR/does_not_acccept_args.rs:15 :1
10+ --> $DIR/does_not_acccept_args.rs:16 :1
1111 |
1212LL | #[diagnostic::do_not_recommend(not_accepted = "foo")]
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414
1515warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
16- --> $DIR/does_not_acccept_args.rs:19 :1
16+ --> $DIR/does_not_acccept_args.rs:20 :1
1717 |
1818LL | #[diagnostic::do_not_recommend(not_accepted(42))]
1919 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020
21- warning: 3 warnings emitted
21+ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
22+ --> $DIR/does_not_acccept_args.rs:24:1
23+ |
24+ LL | #[diagnostic::do_not_recommend(x = y + z)]
25+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
27+ warning: 4 warnings emitted
2228
Original file line number Diff line number Diff line change 11warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
2- --> $DIR/does_not_acccept_args.rs:11 :1
2+ --> $DIR/does_not_acccept_args.rs:12 :1
33 |
44LL | #[diagnostic::do_not_recommend(not_accepted)]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
77 = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
88
99warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
10- --> $DIR/does_not_acccept_args.rs:15 :1
10+ --> $DIR/does_not_acccept_args.rs:16 :1
1111 |
1212LL | #[diagnostic::do_not_recommend(not_accepted = "foo")]
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414
1515warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
16- --> $DIR/does_not_acccept_args.rs:19 :1
16+ --> $DIR/does_not_acccept_args.rs:20 :1
1717 |
1818LL | #[diagnostic::do_not_recommend(not_accepted(42))]
1919 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020
21- warning: 3 warnings emitted
21+ warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
22+ --> $DIR/does_not_acccept_args.rs:24:1
23+ |
24+ LL | #[diagnostic::do_not_recommend(x = y + z)]
25+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
27+ warning: 4 warnings emitted
2228
Original file line number Diff line number Diff line change 77trait Foo { }
88trait Bar { }
99trait Baz { }
10+ trait Boo { }
1011
1112#[ diagnostic:: do_not_recommend( not_accepted) ]
1213//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
@@ -20,4 +21,8 @@ impl<T> Bar for T where T: Send {}
2021//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
2122impl < T > Baz for T where T : Send { }
2223
24+ #[ diagnostic:: do_not_recommend( x = y + z) ]
25+ //~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments
26+ impl < T > Boo for T where T : Send { }
27+
2328fn main ( ) { }
You can’t perform that action at this time.
0 commit comments