Skip to content

Commit c960552

Browse files
Add regression test
1 parent d3ae065 commit c960552

2 files changed

Lines changed: 190 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//@ check-pass
2+
#![feature(sanitize)]
3+
#![feature(register_tool)]
4+
#![feature(export_stable)]
5+
#![feature(lang_items)]
6+
#![feature(dropck_eyepatch)]
7+
#![warn(unused)]
8+
9+
macro_rules! test { () => {} }
10+
11+
#[doc = ""]
12+
//~^ WARN unused doc comment
13+
#[diagnostic::do_not_recommend]
14+
//~^ WARN can only be placed on trait implementations
15+
#[diagnostic::on_const]
16+
//~^ WARN unknown diagnostic attribute
17+
#[diagnostic::on_move]
18+
//~^ WARN unknown diagnostic attribute
19+
#[diagnostic::on_unimplemented]
20+
//~^ WARN can only be applied to trait definitions
21+
#[diagnostic::on_unknown]
22+
//~^ WARN unknown diagnostic attribute
23+
#[diagnostic::on_unmatch_args]
24+
//~^ WARN unknown diagnostic attribute
25+
#[sanitize()]
26+
//~^ WARN attribute cannot be used on macro calls
27+
//~| WARN previously accepted
28+
#[register_tool(test)]
29+
//~^ WARN attribute cannot be used on macro calls
30+
//~| WARN previously accepted
31+
#[link(name = "x")]
32+
//~^ WARN attribute cannot be used on macro calls
33+
//~| WARN previously accepted
34+
#[export_stable]
35+
//~^ WARN attribute cannot be used on macro calls
36+
//~| WARN previously accepted
37+
#[repr(align(64))]
38+
//~^ WARN attribute cannot be used on macro calls
39+
//~| WARN previously accepted
40+
#[lang = "sized"]
41+
//~^ WARN attribute cannot be used on macro calls
42+
//~| WARN previously accepted
43+
#[panic_handler]
44+
//~^ WARN attribute cannot be used on macro calls
45+
//~| WARN previously accepted
46+
#[may_dangle]
47+
//~^ WARN attribute cannot be used on macro calls
48+
//~| WARN previously accepted
49+
test!();
50+
51+
fn main() {}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
warning: unknown diagnostic attribute
2+
--> $DIR/macro-call-attr.rs:15:15
3+
|
4+
LL | #[diagnostic::on_const]
5+
| ^^^^^^^^
6+
|
7+
= help: add `#![feature(diagnostic_on_const)]` to the crate attributes to enable
8+
= note: `#[warn(unknown_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
9+
10+
warning: unknown diagnostic attribute
11+
--> $DIR/macro-call-attr.rs:17:15
12+
|
13+
LL | #[diagnostic::on_move]
14+
| ^^^^^^^
15+
|
16+
= help: add `#![feature(diagnostic_on_move)]` to the crate attributes to enable
17+
18+
warning: unknown diagnostic attribute
19+
--> $DIR/macro-call-attr.rs:21:15
20+
|
21+
LL | #[diagnostic::on_unknown]
22+
| ^^^^^^^^^^
23+
|
24+
= help: add `#![feature(diagnostic_on_unknown)]` to the crate attributes to enable
25+
26+
warning: unknown diagnostic attribute
27+
--> $DIR/macro-call-attr.rs:23:15
28+
|
29+
LL | #[diagnostic::on_unmatch_args]
30+
| ^^^^^^^^^^^^^^^
31+
|
32+
= help: add `#![feature(diagnostic_on_unmatch_args)]` to the crate attributes to enable
33+
34+
warning: unused doc comment
35+
--> $DIR/macro-call-attr.rs:11:1
36+
|
37+
LL | #[doc = ""]
38+
| ^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations
39+
|
40+
= help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion
41+
note: the lint level is defined here
42+
--> $DIR/macro-call-attr.rs:7:9
43+
|
44+
LL | #![warn(unused)]
45+
| ^^^^^^
46+
= note: `#[warn(unused_doc_comments)]` implied by `#[warn(unused)]`
47+
48+
warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations
49+
--> $DIR/macro-call-attr.rs:13:1
50+
|
51+
LL | #[diagnostic::do_not_recommend]
52+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53+
...
54+
LL | test!();
55+
| ------- not a trait implementation
56+
|
57+
= note: `#[warn(misplaced_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
58+
59+
warning: `#[diagnostic::on_unimplemented]` can only be applied to trait definitions
60+
--> $DIR/macro-call-attr.rs:19:1
61+
|
62+
LL | #[diagnostic::on_unimplemented]
63+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64+
65+
warning: `#[sanitize]` attribute cannot be used on macro calls
66+
--> $DIR/macro-call-attr.rs:25:1
67+
|
68+
LL | #[sanitize()]
69+
| ^^^^^^^^^^^^^
70+
|
71+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
72+
= help: `#[sanitize]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
73+
= note: `#[warn(unused_attributes)]` implied by `#[warn(unused)]`
74+
75+
warning: `#[register_tool]` attribute cannot be used on macro calls
76+
--> $DIR/macro-call-attr.rs:28:1
77+
|
78+
LL | #[register_tool(test)]
79+
| ^^^^^^^^^^^^^^^^^^^^^^
80+
|
81+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
82+
= help: `#[register_tool]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
83+
84+
warning: `#[link]` attribute cannot be used on macro calls
85+
--> $DIR/macro-call-attr.rs:31:1
86+
|
87+
LL | #[link(name = "x")]
88+
| ^^^^^^^^^^^^^^^^^^^
89+
|
90+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
91+
= help: `#[link]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
92+
93+
warning: `#[export_stable]` attribute cannot be used on macro calls
94+
--> $DIR/macro-call-attr.rs:34:1
95+
|
96+
LL | #[export_stable]
97+
| ^^^^^^^^^^^^^^^^
98+
|
99+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
100+
= help: `#[export_stable]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
101+
102+
warning: `#[repr]` attribute cannot be used on macro calls
103+
--> $DIR/macro-call-attr.rs:37:1
104+
|
105+
LL | #[repr(align(64))]
106+
| ^^^^^^^^^^^^^^^^^^
107+
|
108+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
109+
= help: `#[repr]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
110+
111+
warning: `#[lang]` attribute cannot be used on macro calls
112+
--> $DIR/macro-call-attr.rs:40:1
113+
|
114+
LL | #[lang = "sized"]
115+
| ^^^^^^^^^^^^^^^^^
116+
|
117+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
118+
= help: `#[lang]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
119+
120+
warning: `#[panic_handler]` attribute cannot be used on macro calls
121+
--> $DIR/macro-call-attr.rs:43:1
122+
|
123+
LL | #[panic_handler]
124+
| ^^^^^^^^^^^^^^^^
125+
|
126+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
127+
= help: `#[panic_handler]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
128+
129+
warning: `#[may_dangle]` attribute cannot be used on macro calls
130+
--> $DIR/macro-call-attr.rs:46:1
131+
|
132+
LL | #[may_dangle]
133+
| ^^^^^^^^^^^^^
134+
|
135+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
136+
= help: `#[may_dangle]` can be applied to associated consts, associated types, const parameters, const parameters, constants, crates, data types, enum variants, extern crates, foreign modules, foreign statics, function params, functions, global asms, impl blocks, lifetime parameters, lifetime parameters, macro defs, match arms, modules, pattern fields, statics, struct fields, struct fields, trait aliases, traits, type aliases, type parameters, type parameters, use statements, and where predicates
137+
138+
warning: 15 warnings emitted
139+

0 commit comments

Comments
 (0)