]> git.lizzy.rs Git - rust.git/blob - src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs
rustdoc: remove unused CSS `#results > table`
[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_middle;
7 extern crate rustc_session;
8
9 use rustc_session::lint::{LintArray, LintPass};
10 use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
11
12 declare_lint! {
13     pub TEST_LINT,
14     Allow,
15     "test"
16 }
17
18 struct Foo;
19
20 impl LintPass for Foo { //~ERROR implementing `LintPass` by hand
21     fn name(&self) -> &'static str {
22         "Foo"
23     }
24 }
25
26 macro_rules! custom_lint_pass_macro {
27     () => {
28         struct Custom;
29
30         impl LintPass for Custom { //~ERROR implementing `LintPass` by hand
31             fn name(&self) -> &'static str {
32                 "Custom"
33             }
34         }
35     };
36 }
37
38 custom_lint_pass_macro!();
39
40 struct Bar;
41
42 impl_lint_pass!(Bar => [TEST_LINT]);
43
44 declare_lint_pass!(Baz => [TEST_LINT]);
45
46 fn main() {}