]> git.lizzy.rs Git - rust.git/blob - src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs
Turn internal lints into tool lints
[rust.git] / src / test / ui-fulldeps / internal-lints / lint_pass_impl_without_macro.rs
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};
9 use rustc::{declare_lint, declare_lint_pass, impl_lint_pass, lint_array};
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
20     fn get_lints(&self) -> LintArray {
21         lint_array!(TEST_LINT)
22     }
23
24     fn name(&self) -> &'static str {
25         "Foo"
26     }
27 }
28
29 macro_rules! custom_lint_pass_macro {
30     () => {
31         struct Custom;
32
33         impl LintPass for Custom { //~ERROR implementing `LintPass` by hand
34             fn get_lints(&self) -> LintArray {
35                 lint_array!(TEST_LINT)
36             }
37
38             fn name(&self) -> &'static str {
39                 "Custom"
40             }
41         }
42     };
43 }
44
45 custom_lint_pass_macro!();
46
47 struct Bar;
48
49 impl_lint_pass!(Bar => [TEST_LINT]);
50
51 declare_lint_pass!(Baz => [TEST_LINT]);
52
53 fn main() {}