diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/ui-fulldeps/plugin | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui-fulldeps/plugin')
53 files changed, 1062 insertions, 0 deletions
diff --git a/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs new file mode 100644 index 000000000..c24cdc97a --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs @@ -0,0 +1,9 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_driver; +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs new file mode 100644 index 000000000..3f6caecaa --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs @@ -0,0 +1,61 @@ +#![feature(plugin, rustc_private)] +#![crate_type = "dylib"] + +extern crate rustc_ast_pretty; +extern crate rustc_driver; +extern crate rustc_hir; +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; +extern crate rustc_ast; +extern crate rustc_span; + +use rustc_ast_pretty::pprust; +use rustc_driver::plugin::Registry; +use rustc_hir as hir; +use rustc_hir::intravisit; +use rustc_hir::Node; +use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_span::def_id::LocalDefId; +use rustc_span::source_map; + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&MISSING_ALLOWED_ATTR]); + reg.lint_store.register_late_pass(|_| Box::new(MissingAllowedAttrPass)); +} + +declare_lint! { + MISSING_ALLOWED_ATTR, + Deny, + "Checks for missing `allowed_attr` attribute" +} + +declare_lint_pass!(MissingAllowedAttrPass => [MISSING_ALLOWED_ATTR]); + +impl<'tcx> LateLintPass<'tcx> for MissingAllowedAttrPass { + fn check_fn( + &mut self, + cx: &LateContext<'tcx>, + _: intravisit::FnKind<'tcx>, + _: &'tcx hir::FnDecl, + _: &'tcx hir::Body, + span: source_map::Span, + def_id: LocalDefId, + ) { + let id = cx.tcx.hir().local_def_id_to_hir_id(def_id); + let item = match cx.tcx.hir().get(id) { + Node::Item(item) => item, + _ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent_item(id).def_id), + }; + + let allowed = |attr| pprust::attribute_to_string(attr).contains("allowed_attr"); + if !cx.tcx.hir().attrs(item.hir_id()).iter().any(allowed) { + cx.lint( + MISSING_ALLOWED_ATTR, + "Missing 'allowed_attr' attribute", + |lint| lint.set_span(span) + ); + } + } +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs new file mode 100644 index 000000000..6304c07d2 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs @@ -0,0 +1,43 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_driver; +extern crate rustc_hir; +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; +extern crate rustc_ast; +extern crate rustc_span; + +use rustc_ast::attr; +use rustc_driver::plugin::Registry; +use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_span::def_id::CRATE_DEF_ID; +use rustc_span::symbol::Symbol; + +declare_lint! { + CRATE_NOT_OKAY, + Warn, + "crate not marked with #![crate_okay]" +} + +declare_lint_pass!(Pass => [CRATE_NOT_OKAY]); + +impl<'tcx> LateLintPass<'tcx> for Pass { + fn check_crate(&mut self, cx: &LateContext) { + let attrs = cx.tcx.hir().attrs(rustc_hir::CRATE_HIR_ID); + let span = cx.tcx.def_span(CRATE_DEF_ID); + if !attr::contains_name(attrs, Symbol::intern("crate_okay")) { + cx.lint(CRATE_NOT_OKAY, "crate is not marked with #![crate_okay]", |lint| { + lint.set_span(span) + }); + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&CRATE_NOT_OKAY]); + reg.lint_store.register_late_pass(|_| Box::new(Pass)); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs new file mode 100644 index 000000000..4a41e7fbb --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs @@ -0,0 +1,44 @@ +// force-host + +#![feature(rustc_private)] + +// Load rustc as a plugin to get macros. +extern crate rustc_driver; +extern crate rustc_hir; +#[macro_use] +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; + +use rustc_driver::plugin::Registry; +use rustc_lint::{LateContext, LateLintPass, LintArray, LintContext, LintId, LintPass}; + +declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); + +declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); + +declare_lint_pass!(Pass => [TEST_LINT, PLEASE_LINT]); + +impl<'tcx> LateLintPass<'tcx> for Pass { + fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) { + match it.ident.as_str() { + "lintme" => cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)), + "pleaselintme" => { + cx.lint(PLEASE_LINT, "item is named 'pleaselintme'", |lint| lint.set_span(it.span)) + } + _ => {} + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&TEST_LINT, &PLEASE_LINT]); + reg.lint_store.register_late_pass(|_| Box::new(Pass)); + reg.lint_store.register_group( + true, + "lint_me", + None, + vec![LintId::of(&TEST_LINT), LintId::of(&PLEASE_LINT)], + ); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs new file mode 100644 index 000000000..30956deb7 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs @@ -0,0 +1,33 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_ast; + +// Load rustc as a plugin to get macros +extern crate rustc_driver; +#[macro_use] +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; + +use rustc_driver::plugin::Registry; +use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; +use rustc_ast as ast; +declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); + +declare_lint_pass!(Pass => [TEST_LINT]); + +impl EarlyLintPass for Pass { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { + if it.ident.name.as_str() == "lintme" { + cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)); + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&TEST_LINT]); + reg.lint_store.register_early_pass(|| Box::new(Pass)); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs b/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs new file mode 100644 index 000000000..c2c024865 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs @@ -0,0 +1,52 @@ +#![feature(rustc_private)] + +extern crate rustc_ast; + +// Load rustc as a plugin to get macros +extern crate rustc_driver; +#[macro_use] +extern crate rustc_lint; +#[macro_use] +extern crate rustc_session; + +use rustc_driver::plugin::Registry; +use rustc_lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintId, LintPass}; +use rustc_ast as ast; +declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); +declare_tool_lint!( + /// Some docs + pub clippy::TEST_GROUP, + Warn, "Warn about other stuff" +); + +declare_tool_lint!( + /// Some docs + pub rustc::TEST_RUSTC_TOOL_LINT, + Deny, + "Deny internal stuff" +); + +declare_lint_pass!(Pass => [TEST_LINT, TEST_GROUP, TEST_RUSTC_TOOL_LINT]); + +impl EarlyLintPass for Pass { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { + if it.ident.name.as_str() == "lintme" { + cx.lint(TEST_LINT, "item is named 'lintme'", |lint| lint.set_span(it.span)); + } + if it.ident.name.as_str() == "lintmetoo" { + cx.lint(TEST_GROUP, "item is named 'lintmetoo'", |lint| lint.set_span(it.span)); + } + } +} + +#[no_mangle] +fn __rustc_plugin_registrar(reg: &mut Registry) { + reg.lint_store.register_lints(&[&TEST_RUSTC_TOOL_LINT, &TEST_LINT, &TEST_GROUP]); + reg.lint_store.register_early_pass(|| Box::new(Pass)); + reg.lint_store.register_group( + true, + "clippy::group", + Some("clippy_group"), + vec![LintId::of(&TEST_LINT), LintId::of(&TEST_GROUP)], + ); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs new file mode 100644 index 000000000..954a1e554 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs @@ -0,0 +1,5 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs new file mode 100644 index 000000000..9b075c1a5 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs @@ -0,0 +1,11 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_reg: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs new file mode 100644 index 000000000..fd6e9e20f --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs new file mode 100644 index 000000000..fd6e9e20f --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs @@ -0,0 +1,10 @@ +#![crate_type = "dylib"] +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs b/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs new file mode 100644 index 000000000..e83dfe804 --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs @@ -0,0 +1,24 @@ +// force-host + +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use std::any::Any; +use std::cell::RefCell; +use rustc_driver::plugin::Registry; + +struct Foo { + foo: isize +} + +impl Drop for Foo { + fn drop(&mut self) {} +} + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) { + thread_local!(static FOO: RefCell<Option<Box<Any+Send>>> = RefCell::new(None)); + FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box<Any+Send>)); +} diff --git a/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs b/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs new file mode 100644 index 000000000..3ba73538e --- /dev/null +++ b/tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs @@ -0,0 +1,12 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![feature(rustc_private)] + +extern crate rustc_middle; +extern crate rustc_driver; + +use rustc_driver::plugin::Registry; + +#[no_mangle] +fn __rustc_plugin_registrar(_: &mut Registry) {} diff --git a/tests/ui-fulldeps/plugin/feature-gate-plugin.rs b/tests/ui-fulldeps/plugin/feature-gate-plugin.rs new file mode 100644 index 000000000..85eaf5336 --- /dev/null +++ b/tests/ui-fulldeps/plugin/feature-gate-plugin.rs @@ -0,0 +1,8 @@ +// aux-build:empty-plugin.rs +// ignore-stage1 + +#![plugin(empty_plugin)] +//~^ ERROR compiler plugins are deprecated +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr b/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr new file mode 100644 index 000000000..5e40561c7 --- /dev/null +++ b/tests/ui-fulldeps/plugin/feature-gate-plugin.stderr @@ -0,0 +1,20 @@ +error[E0658]: compiler plugins are deprecated + --> $DIR/feature-gate-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #29597 <https://github.com/rust-lang/rust/issues/29597> for more information + = help: add `#![feature(plugin)]` to the crate attributes to enable + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/feature-gate-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui-fulldeps/plugin/gated-plugin.rs b/tests/ui-fulldeps/plugin/gated-plugin.rs new file mode 100644 index 000000000..85eaf5336 --- /dev/null +++ b/tests/ui-fulldeps/plugin/gated-plugin.rs @@ -0,0 +1,8 @@ +// aux-build:empty-plugin.rs +// ignore-stage1 + +#![plugin(empty_plugin)] +//~^ ERROR compiler plugins are deprecated +//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/gated-plugin.stderr b/tests/ui-fulldeps/plugin/gated-plugin.stderr new file mode 100644 index 000000000..f48f1eab6 --- /dev/null +++ b/tests/ui-fulldeps/plugin/gated-plugin.stderr @@ -0,0 +1,20 @@ +error[E0658]: compiler plugins are deprecated + --> $DIR/gated-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #29597 <https://github.com/rust-lang/rust/issues/29597> for more information + = help: add `#![feature(plugin)]` to the crate attributes to enable + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/gated-plugin.rs:4:1 + | +LL | #![plugin(empty_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui-fulldeps/plugin/issue-15778-fail.rs b/tests/ui-fulldeps/plugin/issue-15778-fail.rs new file mode 100644 index 000000000..beecaadf9 --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-15778-fail.rs @@ -0,0 +1,9 @@ +// aux-build:lint-for-crate.rs +// ignore-stage1 +// compile-flags: -D crate-not-okay + +#![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +#![plugin(lint_for_crate)] +//~^ WARN use of deprecated attribute `plugin` + +pub fn main() { } diff --git a/tests/ui-fulldeps/plugin/issue-15778-fail.stderr b/tests/ui-fulldeps/plugin/issue-15778-fail.stderr new file mode 100644 index 000000000..a37893e12 --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-15778-fail.stderr @@ -0,0 +1,22 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/issue-15778-fail.rs:6:1 + | +LL | #![plugin(lint_for_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: crate is not marked with #![crate_okay] + --> $DIR/issue-15778-fail.rs:5:1 + | +LL | / #![feature(plugin)] +LL | | #![plugin(lint_for_crate)] +LL | | +LL | | +LL | | pub fn main() { } + | |_________________^ + | + = note: requested on the command line with `-D crate-not-okay` + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/issue-40001.rs b/tests/ui-fulldeps/plugin/issue-40001.rs new file mode 100644 index 000000000..e14338fdb --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-40001.rs @@ -0,0 +1,10 @@ +// run-pass +// aux-build:issue-40001-plugin.rs +// ignore-stage1 + +#![feature(plugin, register_tool)] +#![plugin(issue_40001_plugin)] //~ WARNING compiler plugins are deprecated +#![register_tool(plugin)] + +#[plugin::allowed_attr] +fn main() {} diff --git a/tests/ui-fulldeps/plugin/issue-40001.stderr b/tests/ui-fulldeps/plugin/issue-40001.stderr new file mode 100644 index 000000000..73ec06924 --- /dev/null +++ b/tests/ui-fulldeps/plugin/issue-40001.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/issue-40001.rs:6:1 + | +LL | #![plugin(issue_40001_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs new file mode 100644 index 000000000..9f8a87960 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs @@ -0,0 +1,17 @@ +// aux-build:lint-group-plugin-test.rs +// ignore-stage1 +// compile-flags: -D lint-me + +#![feature(plugin)] + +#![plugin(lint_group_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` + +fn lintme() { } //~ ERROR item is named 'lintme' + +fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' + +pub fn main() { + lintme(); + pleaselintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr new file mode 100644 index 000000000..20486d596 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr @@ -0,0 +1,26 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-group-plugin-deny-cmdline.rs:7:1 + | +LL | #![plugin(lint_group_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: item is named 'lintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `-D test-lint` implied by `-D lint-me` + +error: item is named 'pleaselintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:12:1 + | +LL | fn pleaselintme() { } + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D please-lint` implied by `-D lint-me` + +error: aborting due to 2 previous errors; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin.rs b/tests/ui-fulldeps/plugin/lint-group-plugin.rs new file mode 100644 index 000000000..7b74be7a9 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin.rs @@ -0,0 +1,17 @@ +// run-pass +// aux-build:lint-group-plugin-test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_group_plugin_test)] //~ WARNING use of deprecated attribute +#![allow(dead_code)] + +fn lintme() { } //~ WARNING item is named 'lintme' +fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' + +#[allow(lint_me)] +pub fn main() { + fn lintme() { } + + fn pleaselintme() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-group-plugin.stderr b/tests/ui-fulldeps/plugin/lint-group-plugin.stderr new file mode 100644 index 000000000..6f429dad0 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-group-plugin.stderr @@ -0,0 +1,26 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-group-plugin.rs:6:1 + | +LL | #![plugin(lint_group_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: item is named 'lintme' + --> $DIR/lint-group-plugin.rs:9:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(test_lint)]` on by default + +warning: item is named 'pleaselintme' + --> $DIR/lint-group-plugin.rs:10:1 + | +LL | fn pleaselintme() { } + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(please_lint)]` on by default + +warning: 3 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs new file mode 100644 index 000000000..1cc16e2fd --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs @@ -0,0 +1,12 @@ +// check-pass +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -A test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] //~ WARNING compiler plugins are deprecated + +fn lintme() { } + +pub fn main() { +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr new file mode 100644 index 000000000..f06703a27 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-cmdline-allow.rs:7:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs new file mode 100644 index 000000000..0bd95dfbd --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs @@ -0,0 +1,13 @@ +// check-pass +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -Z crate-attr=plugin(lint_plugin_test) + +#![feature(plugin)] + +fn lintme() { } //~ WARNING item is named 'lintme' + +#[allow(test_lint)] +pub fn main() { + fn lintme() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr new file mode 100644 index 000000000..82679c9e1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr @@ -0,0 +1,18 @@ +warning: item is named 'lintme' + --> $DIR/lint-plugin-cmdline-load.rs:8:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(test_lint)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> <crate attribute>:1:1 + | +LL | plugin(lint_plugin_test) + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 2 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs new file mode 100644 index 000000000..04230a8e8 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs @@ -0,0 +1,13 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` +#![deny(test_lint)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr new file mode 100644 index 000000000..5e8891bf1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr @@ -0,0 +1,22 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-attr.rs:9:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-plugin-deny-attr.rs:7:9 + | +LL | #![deny(test_lint)] + | ^^^^^^^^^ + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-attr.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs new file mode 100644 index 000000000..c460cfd5f --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs @@ -0,0 +1,13 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -D test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr new file mode 100644 index 000000000..d5d6b5352 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr @@ -0,0 +1,18 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-cmdline.rs:9:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-D test-lint` + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-deny-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs new file mode 100644 index 000000000..cf31b3ec1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs @@ -0,0 +1,16 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` +#![forbid(test_lint)] + +fn lintme() {} //~ ERROR item is named 'lintme' + +#[allow(test_lint)] +//~^ ERROR allow(test_lint) incompatible +//~| ERROR allow(test_lint) incompatible +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr new file mode 100644 index 000000000..ae34b25cc --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr @@ -0,0 +1,41 @@ +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-attrs.rs:11:9 + | +LL | #![forbid(test_lint)] + | --------- `forbid` level set here +... +LL | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-attrs.rs:9:1 + | +LL | fn lintme() {} + | ^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-plugin-forbid-attrs.rs:7:11 + | +LL | #![forbid(test_lint)] + | ^^^^^^^^^ + +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-attrs.rs:11:9 + | +LL | #![forbid(test_lint)] + | --------- `forbid` level set here +... +LL | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-attrs.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0453`. diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs new file mode 100644 index 000000000..b9d1aa85a --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs @@ -0,0 +1,15 @@ +// aux-build:lint-plugin-test.rs +// ignore-stage1 +// compile-flags: -F test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +//~^ WARN use of deprecated attribute `plugin` +fn lintme() { } //~ ERROR item is named 'lintme' + +#[allow(test_lint)] //~ ERROR allow(test_lint) incompatible + //~| ERROR allow(test_lint) incompatible + +pub fn main() { + lintme(); +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr new file mode 100644 index 000000000..491c4d206 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr @@ -0,0 +1,35 @@ +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 + | +LL | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + | + = note: `forbid` lint level was set on command line + +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-cmdline.rs:8:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-F test-lint` + +error[E0453]: allow(test_lint) incompatible with previous forbid + --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 + | +LL | #[allow(test_lint)] + | ^^^^^^^^^ overruled by previous forbid + | + = note: `forbid` lint level was set on command line + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin-forbid-cmdline.rs:6:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted + +For more information about this error, try `rustc --explain E0453`. diff --git a/tests/ui-fulldeps/plugin/lint-plugin.rs b/tests/ui-fulldeps/plugin/lint-plugin.rs new file mode 100644 index 000000000..66057eea6 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin.rs @@ -0,0 +1,13 @@ +// run-pass +// aux-build:lint-plugin-test.rs +// ignore-stage1 +#![feature(plugin)] +#![plugin(lint_plugin_test)] //~ WARNING use of deprecated attribute +#![allow(dead_code)] + +fn lintme() { } //~ WARNING item is named 'lintme' + +#[allow(test_lint)] +pub fn main() { + fn lintme() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-plugin.stderr b/tests/ui-fulldeps/plugin/lint-plugin.stderr new file mode 100644 index 000000000..dd5d3d72e --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-plugin.stderr @@ -0,0 +1,18 @@ +warning: item is named 'lintme' + --> $DIR/lint-plugin.rs:8:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(test_lint)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-plugin.rs:5:1 + | +LL | #![plugin(lint_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 2 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs new file mode 100644 index 000000000..83a8b3e1a --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs @@ -0,0 +1,12 @@ +// check-pass +// aux-build:lint-tool-test.rs +// ignore-stage1 +// compile-flags: -A test-lint + +#![feature(plugin)] +#![plugin(lint_tool_test)] //~ WARNING compiler plugins are deprecated + +fn lintme() {} +//~^ WARNING item is named 'lintme' [clippy::test_lint] + +pub fn main() {} diff --git a/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr new file mode 100644 index 000000000..b060e3a3e --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr @@ -0,0 +1,30 @@ +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: item is named 'lintme' + --> $DIR/lint-tool-cmdline-allow.rs:9:1 + | +LL | fn lintme() {} + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(clippy::test_lint)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-cmdline-allow.rs:7:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint + | + = note: requested on the command line with `-A test_lint` + +warning: 5 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lint-tool-test.rs b/tests/ui-fulldeps/plugin/lint-tool-test.rs new file mode 100644 index 000000000..f92bcd213 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-test.rs @@ -0,0 +1,36 @@ +// aux-build:lint-tool-test.rs +// ignore-stage1 +// compile-flags: --cfg foo + +#![feature(plugin)] +#![plugin(lint_tool_test)] +//~^ WARN use of deprecated attribute `plugin` +#![allow(dead_code)] +#![cfg_attr(foo, warn(test_lint))] +//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future +#![deny(clippy_group)] +//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future + +fn lintme() { } //~ ERROR item is named 'lintme' + +#[allow(clippy::group)] +fn lintmetoo() {} + +#[allow(clippy::test_lint)] +pub fn main() { + fn lintme() { } + fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' +} + +#[allow(test_group)] +//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future +#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` +fn hello() { + fn lintmetoo() { } +} diff --git a/tests/ui-fulldeps/plugin/lint-tool-test.stderr b/tests/ui-fulldeps/plugin/lint-tool-test.stderr new file mode 100644 index 000000000..027cf8f80 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lint-tool-test.stderr @@ -0,0 +1,95 @@ +warning: lint name `test_lint` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:9:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + | + = note: `#[warn(renamed_and_removed_lints)]` on by default + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:29:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +warning: lint name `test_lint` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:9:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +error: item is named 'lintme' + --> $DIR/lint-tool-test.rs:18:1 + | +LL | fn lintme() { } + | ^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ + = note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]` + +error: item is named 'lintmetoo' + --> $DIR/lint-tool-test.rs:26:5 + | +LL | fn lintmetoo() { } + | ^^^^^^^^^^^^^^^^^^ + | + = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:29:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +warning: unknown lint: `this_lint_does_not_exist` + --> $DIR/lint-tool-test.rs:33:8 + | +LL | #[deny(this_lint_does_not_exist)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_lints)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lint-tool-test.rs:6:1 + | +LL | #![plugin(lint_tool_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: lint name `test_lint` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:9:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:13:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:29:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +error: aborting due to 2 previous errors; 11 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/lto-syntax-extension.rs b/tests/ui-fulldeps/plugin/lto-syntax-extension.rs new file mode 100644 index 000000000..5964e70f1 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lto-syntax-extension.rs @@ -0,0 +1,15 @@ +// run-pass +// aux-build:lto-syntax-extension-lib.rs +// aux-build:lto-syntax-extension-plugin.rs +// compile-flags:-C lto +// ignore-stage1 +// no-prefer-dynamic + +#![feature(plugin)] +#![plugin(lto_syntax_extension_plugin)] //~ WARNING compiler plugins are deprecated + +extern crate lto_syntax_extension_lib; + +fn main() { + lto_syntax_extension_lib::foo(); +} diff --git a/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr b/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr new file mode 100644 index 000000000..555493f32 --- /dev/null +++ b/tests/ui-fulldeps/plugin/lto-syntax-extension.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/lto-syntax-extension.rs:9:1 + | +LL | #![plugin(lto_syntax_extension_plugin)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/macro-crate-rlib.rs b/tests/ui-fulldeps/plugin/macro-crate-rlib.rs new file mode 100644 index 000000000..38bd34053 --- /dev/null +++ b/tests/ui-fulldeps/plugin/macro-crate-rlib.rs @@ -0,0 +1,9 @@ +// aux-build:rlib-crate-test.rs +// ignore-stage1 +// ignore-cross-compile gives a different error message + +#![feature(plugin)] +#![plugin(rlib_crate_test)] +//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr b/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr new file mode 100644 index 000000000..0651cee56 --- /dev/null +++ b/tests/ui-fulldeps/plugin/macro-crate-rlib.stderr @@ -0,0 +1,9 @@ +error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format + --> $DIR/macro-crate-rlib.rs:6:11 + | +LL | #![plugin(rlib_crate_test)] + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0457`. diff --git a/tests/ui-fulldeps/plugin/multiple-plugins.rs b/tests/ui-fulldeps/plugin/multiple-plugins.rs new file mode 100644 index 000000000..9af3ebd57 --- /dev/null +++ b/tests/ui-fulldeps/plugin/multiple-plugins.rs @@ -0,0 +1,12 @@ +// run-pass +// aux-build:multiple-plugins-1.rs +// aux-build:multiple-plugins-2.rs +// ignore-stage1 + +// Check that the plugin registrar of multiple plugins doesn't conflict + +#![feature(plugin)] +#![plugin(multiple_plugins_1)] //~ WARN use of deprecated attribute `plugin` +#![plugin(multiple_plugins_2)] //~ WARN use of deprecated attribute `plugin` + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/multiple-plugins.stderr b/tests/ui-fulldeps/plugin/multiple-plugins.stderr new file mode 100644 index 000000000..878ffabfc --- /dev/null +++ b/tests/ui-fulldeps/plugin/multiple-plugins.stderr @@ -0,0 +1,16 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/multiple-plugins.rs:9:1 + | +LL | #![plugin(multiple_plugins_1)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/multiple-plugins.rs:10:1 + | +LL | #![plugin(multiple_plugins_2)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + +warning: 2 warnings emitted + diff --git a/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs b/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs new file mode 100644 index 000000000..fb22888d9 --- /dev/null +++ b/tests/ui-fulldeps/plugin/outlive-expansion-phase.rs @@ -0,0 +1,8 @@ +// run-pass +// aux-build:outlive-expansion-phase.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(outlive_expansion_phase)] //~ WARNING compiler plugins are deprecated + +pub fn main() {} diff --git a/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr b/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr new file mode 100644 index 000000000..e40a08ae7 --- /dev/null +++ b/tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr @@ -0,0 +1,10 @@ +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/outlive-expansion-phase.rs:6:1 + | +LL | #![plugin(outlive_expansion_phase)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui-fulldeps/plugin/plugin-args.rs b/tests/ui-fulldeps/plugin/plugin-args.rs new file mode 100644 index 000000000..488f2b775 --- /dev/null +++ b/tests/ui-fulldeps/plugin/plugin-args.rs @@ -0,0 +1,9 @@ +// aux-build:empty-plugin.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(empty_plugin(args))] +//~^ ERROR malformed `plugin` attribute +//~| WARNING compiler plugins are deprecated + +fn main() {} diff --git a/tests/ui-fulldeps/plugin/plugin-args.stderr b/tests/ui-fulldeps/plugin/plugin-args.stderr new file mode 100644 index 000000000..177f33005 --- /dev/null +++ b/tests/ui-fulldeps/plugin/plugin-args.stderr @@ -0,0 +1,17 @@ +error[E0498]: malformed `plugin` attribute + --> $DIR/plugin-args.rs:5:11 + | +LL | #![plugin(empty_plugin(args))] + | ^^^^^^^^^^^^^^^^^^ malformed attribute + +warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 + --> $DIR/plugin-args.rs:5:1 + | +LL | #![plugin(empty_plugin(args))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version + | + = note: `#[warn(deprecated)]` on by default + +error: aborting due to previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0498`. diff --git a/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs b/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs new file mode 100644 index 000000000..4d26e08d8 --- /dev/null +++ b/tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs @@ -0,0 +1,10 @@ +// check-pass +// aux-build:empty-plugin.rs +// ignore-cross-compile +// +// empty_plugin will not compile on a cross-compiled target because +// librustc_ast is not compiled for it. + +extern crate empty_plugin; // OK, plugin crates are still crates + +fn main() {} |