plugin_registrary: use normal deprecation instead of hard coded warning.

This commit is contained in:
Mazdak Farrokhzad 2019-10-03 06:46:17 +02:00
parent 287ceed469
commit 1b8ec975fc
21 changed files with 314 additions and 266 deletions

View File

@ -278,13 +278,21 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),
// Plugins:
ungated!(plugin_registrar, Normal, template!(Word)),
(
sym::plugin_registrar, Normal, template!(Word),
Gated(
Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None),
sym::plugin_registrar,
"compiler plugins are deprecated",
cfg_fn!(plugin_registrar)
)
),
(
sym::plugin, CrateLevel, template!(List: "name|name(args)"),
Gated(
Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None),
sym::plugin,
"compiler plugins are deprecated and will be removed in 1.44.0",
"compiler plugins are deprecated",
cfg_fn!(plugin)
)
),

View File

@ -311,10 +311,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
if attr::contains_name(&i.attrs[..], sym::plugin_registrar) {
gate_feature_post!(&self, plugin_registrar, i.span,
"compiler plugins are experimental and possibly buggy");
self.parse_sess.span_diagnostic.span_warn(
i.span,
"`#[plugin_registrar]` is deprecated and will be removed in 1.44.0",
);
}
if attr::contains_name(&i.attrs[..], sym::start) {
gate_feature_post!(&self, start, i.span,

View File

@ -1,8 +1,7 @@
// ignore-tidy-linelength
// aux-build:attr-plugin-test.rs
#![plugin(attr_plugin_test)]
//~^ ERROR compiler plugins are deprecated and will be removed in 1.44.0
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0
//~^ ERROR compiler plugins are deprecated
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0
--> $DIR/gated-plugin.rs:4:1
error[E0658]: compiler plugins are deprecated
--> $DIR/gated-plugin.rs:3:1
|
LL | #![plugin(attr_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -7,8 +7,8 @@ LL | #![plugin(attr_plugin_test)]
= note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add `#![feature(plugin)]` to the crate attributes to enable
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/gated-plugin.rs:4:1
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/gated-plugin.rs:3:1
|
LL | #![plugin(attr_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute

View File

@ -5,6 +5,6 @@
#![feature(plugin)]
#![plugin(rlib_crate_test)]
//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {}

View File

@ -4,7 +4,7 @@ error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be av
LL | #![plugin(rlib_crate_test)]
| ^^^^^^^^^^^^^^^
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/macro-crate-rlib.rs:6:1
|
LL | #![plugin(rlib_crate_test)]

View File

@ -32,9 +32,13 @@
// check-pass
#![feature(test)]
#![feature(test, plugin_registrar)]
#![warn(unused_attributes, unknown_lints)]
// Exception, a gated and deprecated attribute.
#![plugin_registrar] //~ WARN unused attribute
// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES
#![warn(x5400)] //~ WARN unknown lint: `x5400`
@ -43,7 +47,6 @@
#![deny(x5100)] //~ WARN unknown lint: `x5100`
#![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs)
#![macro_export] //~ WARN unused attribute
#![plugin_registrar] //~ WARN unused attribute
// skipping testing of cfg
// skipping testing of cfg_attr
#![main] //~ WARN unused attribute

View File

@ -1,7 +1,7 @@
// Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate
#![plugin(foo)]
//~^ ERROR compiler plugins are deprecated and will be removed in 1.44.0
//~^ ERROR compiler plugins are deprecated
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {}

View File

@ -1,4 +1,4 @@
error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0
error[E0658]: compiler plugins are deprecated
--> $DIR/feature-gate-plugin.rs:3:1
|
LL | #![plugin(foo)]
@ -7,7 +7,7 @@ LL | #![plugin(foo)]
= note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add `#![feature(plugin)]` to the crate attributes to enable
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/feature-gate-plugin.rs:3:1
|
LL | #![plugin(foo)]

View File

@ -3,8 +3,9 @@
// the registration function isn't typechecked yet
#[plugin_registrar]
//~^ ERROR compiler plugins are deprecated
//~| WARN use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated
pub fn registrar() {}
//~^ ERROR compiler plugins are experimental
//~| WARN `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
//~^ ERROR compiler plugins are experimental and possibly buggy
fn main() {}

View File

@ -1,5 +1,5 @@
error[E0658]: compiler plugins are experimental and possibly buggy
--> $DIR/feature-gate-plugin_registrar.rs:6:1
--> $DIR/feature-gate-plugin_registrar.rs:8:1
|
LL | pub fn registrar() {}
| ^^^^^^^^^^^^^^^^^^^^^
@ -7,12 +7,23 @@ LL | pub fn registrar() {}
= note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add `#![feature(plugin_registrar)]` to the crate attributes to enable
warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
--> $DIR/feature-gate-plugin_registrar.rs:6:1
error[E0658]: compiler plugins are deprecated
--> $DIR/feature-gate-plugin_registrar.rs:5:1
|
LL | pub fn registrar() {}
| ^^^^^^^^^^^^^^^^^^^^^
LL | #[plugin_registrar]
| ^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add `#![feature(plugin_registrar)]` to the crate attributes to enable
error: aborting due to previous error
warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/feature-gate-plugin_registrar.rs:5:1
|
LL | #[plugin_registrar]
| ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,10 +1,8 @@
// ignore-tidy-linelength
#![deny(unused_attributes)]
#![feature(plugin)]
#[plugin(bla)] //~ ERROR unused attribute
//~^ ERROR should be an inner attribute
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {}

View File

@ -1,5 +1,5 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/invalid-plugin-attr.rs:6:1
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/invalid-plugin-attr.rs:4:1
|
LL | #[plugin(bla)]
| ^^^^^^^^^^^^^^ help: remove this attribute
@ -7,19 +7,19 @@ LL | #[plugin(bla)]
= note: `#[warn(deprecated)]` on by default
error: unused attribute
--> $DIR/invalid-plugin-attr.rs:6:1
--> $DIR/invalid-plugin-attr.rs:4:1
|
LL | #[plugin(bla)]
| ^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/invalid-plugin-attr.rs:3:9
--> $DIR/invalid-plugin-attr.rs:1:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/invalid-plugin-attr.rs:6:1
--> $DIR/invalid-plugin-attr.rs:4:1
|
LL | #[plugin(bla)]
| ^^^^^^^^^^^^^^

View File

@ -1,7 +1,5 @@
// ignore-tidy-linelength
#![feature(plugin)]
#![plugin] //~ ERROR malformed `plugin` attribute
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {}

View File

@ -1,11 +1,11 @@
error: malformed `plugin` attribute input
--> $DIR/malformed-plugin-1.rs:4:1
--> $DIR/malformed-plugin-1.rs:2:1
|
LL | #![plugin]
| ^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]`
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/malformed-plugin-1.rs:4:1
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/malformed-plugin-1.rs:2:1
|
LL | #![plugin]
| ^^^^^^^^^^ help: remove this attribute

View File

@ -1,7 +1,5 @@
// ignore-tidy-linelength
#![feature(plugin)]
#![plugin="bleh"] //~ ERROR malformed `plugin` attribute
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {}

View File

@ -1,11 +1,11 @@
error: malformed `plugin` attribute input
--> $DIR/malformed-plugin-2.rs:4:1
--> $DIR/malformed-plugin-2.rs:2:1
|
LL | #![plugin="bleh"]
| ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[plugin(name|name(args))]`
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/malformed-plugin-2.rs:4:1
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/malformed-plugin-2.rs:2:1
|
LL | #![plugin="bleh"]
| ^^^^^^^^^^^^^^^^^ help: remove this attribute

View File

@ -1,7 +1,5 @@
// ignore-tidy-linelength
#![feature(plugin)]
#![plugin(foo="bleh")] //~ ERROR malformed `plugin` attribute
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {}

View File

@ -1,11 +1,11 @@
error[E0498]: malformed `plugin` attribute
--> $DIR/malformed-plugin-3.rs:4:1
--> $DIR/malformed-plugin-3.rs:2:1
|
LL | #![plugin(foo="bleh")]
| ^^^^^^^^^^^^^^^^^^^^^^ malformed attribute
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated and will be removed in 1.44.0. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/malformed-plugin-3.rs:4:1
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/malformed-plugin-3.rs:2:1
|
LL | #![plugin(foo="bleh")]
| ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute

View File

@ -1,14 +1,16 @@
warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
--> $DIR/multiple-plugin-registrars.rs:7:1
warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/multiple-plugin-registrars.rs:6:1
|
LL | pub fn one() {}
| ^^^^^^^^^^^^^^^
LL | #[plugin_registrar]
| ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default
warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
--> $DIR/multiple-plugin-registrars.rs:10:1
warning: use of deprecated attribute `plugin_registrar`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/multiple-plugin-registrars.rs:9:1
|
LL | pub fn two() {}
| ^^^^^^^^^^^^^^^
LL | #[plugin_registrar]
| ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
error: multiple plugin registration functions found
|