diff options
| author | flip1995 <hello@philkrones.com> | 2019-05-02 16:53:12 +0200 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2019-06-24 10:45:20 +0200 |
| commit | 7d0a952e465b6584d2a86d2fca3c8a4b077567cd (patch) | |
| tree | e96901aa2ef080ca8d384ed60a74a45341be6bb6 /src/test | |
| parent | 3cc34867339356a34428e9ec3efa618d86228fed (diff) | |
| download | rust-7d0a952e465b6584d2a86d2fca3c8a4b077567cd.tar.gz rust-7d0a952e465b6584d2a86d2fca3c8a4b077567cd.zip | |
Implement initernal lint LINT_PASS_IMPL_WITHOUT_MACRO
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs | 35 | ||||
| -rw-r--r-- | src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr | 15 |
2 files changed, 50 insertions, 0 deletions
diff --git a/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs new file mode 100644 index 00000000000..92f8e8364a7 --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs @@ -0,0 +1,35 @@ +// compile-flags: -Z unstable-options + +#![feature(rustc_private)] +#![deny(lint_pass_impl_without_macro)] + +extern crate rustc; + +use rustc::lint::{LintArray, LintPass}; +use rustc::{declare_lint, declare_lint_pass, impl_lint_pass, lint_array}; + +declare_lint! { + pub TEST_LINT, + Allow, + "test" +} + +struct Foo; + +impl LintPass for Foo { //~ERROR implementing `LintPass` by hand + fn get_lints(&self) -> LintArray { + lint_array!(TEST_LINT) + } + + fn name(&self) -> &'static str { + "Foo" + } +} + +struct Bar; + +impl_lint_pass!(Bar => [TEST_LINT]); + +declare_lint_pass!(Baz => [TEST_LINT]); + +fn main() {} diff --git a/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr new file mode 100644 index 00000000000..9ddd6af472a --- /dev/null +++ b/src/test/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.stderr @@ -0,0 +1,15 @@ +error: implementing `LintPass` by hand + --> $DIR/lint_pass_impl_without_macro.rs:19:6 + | +LL | impl LintPass for Foo { + | ^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint_pass_impl_without_macro.rs:4:9 + | +LL | #![deny(lint_pass_impl_without_macro)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: try using `declare_lint_pass!` or `impl_lint_pass!` instead + +error: aborting due to previous error + |
