]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | // compile-flags: -Z unstable-options |
2 | ||
3 | #![feature(rustc_private)] | |
4 | #![deny(rustc::lint_pass_impl_without_macro)] | |
5 | ||
6 | extern crate rustc; | |
7 | ||
8 | use rustc::lint::{LintArray, LintPass}; | |
e74abb32 | 9 | use rustc::{declare_lint, declare_lint_pass, impl_lint_pass}; |
416331ca XL |
10 | |
11 | declare_lint! { | |
12 | pub TEST_LINT, | |
13 | Allow, | |
14 | "test" | |
15 | } | |
16 | ||
17 | struct Foo; | |
18 | ||
19 | impl LintPass for Foo { //~ERROR implementing `LintPass` by hand | |
416331ca XL |
20 | fn name(&self) -> &'static str { |
21 | "Foo" | |
22 | } | |
23 | } | |
24 | ||
25 | macro_rules! custom_lint_pass_macro { | |
26 | () => { | |
27 | struct Custom; | |
28 | ||
29 | impl LintPass for Custom { //~ERROR implementing `LintPass` by hand | |
416331ca XL |
30 | fn name(&self) -> &'static str { |
31 | "Custom" | |
32 | } | |
33 | } | |
34 | }; | |
35 | } | |
36 | ||
37 | custom_lint_pass_macro!(); | |
38 | ||
39 | struct Bar; | |
40 | ||
41 | impl_lint_pass!(Bar => [TEST_LINT]); | |
42 | ||
43 | declare_lint_pass!(Baz => [TEST_LINT]); | |
44 | ||
45 | fn main() {} |