Skip to content

Commit 6e4f161

Browse files
committed
Demote template check error to a lint for #[test] and #[bench]
1 parent bf8fc8a commit 6e4f161

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/libsyntax/attr/builtin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,8 @@ crate fn check_builtin_attribute(
942942
// Some of previously accepted forms were used in practice,
943943
// report them as warnings for now.
944944
let should_warn = |name| name == sym::doc || name == sym::ignore ||
945-
name == sym::inline || name == sym::link;
945+
name == sym::inline || name == sym::link ||
946+
name == sym::test || name == sym::bench;
946947

947948
match attr.parse_meta(sess) {
948949
Ok(meta) => if !should_skip(name) && !template.compatible(&meta.node) {
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
error: malformed `bench` attribute input
1+
warning: attribute must be of the form `#[bench]`
22
--> $DIR/issue-43106-gating-of-bench.rs:15:1
33
|
44
LL | #![bench = "4100"]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[bench]`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(ill_formed_attribute_input)]` on by default
8+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
9+
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
610

711
error[E0601]: `main` function not found in crate `issue_43106_gating_of_bench`
812
|
913
= note: consider adding a `main` function to `$DIR/issue-43106-gating-of-bench.rs`
1014

11-
error: aborting due to 2 previous errors
15+
error: aborting due to previous error
1216

1317
For more information about this error, try `rustc --explain E0601`.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
error: malformed `test` attribute input
1+
warning: attribute must be of the form `#[test]`
22
--> $DIR/issue-43106-gating-of-test.rs:10:1
33
|
44
LL | #![test = "4200"]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[test]`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(ill_formed_attribute_input)]` on by default
8+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
9+
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
610

711
error[E0601]: `main` function not found in crate `issue_43106_gating_of_test`
812
|
913
= note: consider adding a `main` function to `$DIR/issue-43106-gating-of-test.rs`
1014

11-
error: aborting due to 2 previous errors
15+
error: aborting due to previous error
1216

1317
For more information about this error, try `rustc --explain E0601`.

0 commit comments

Comments
 (0)