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: // 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)"), sym::plugin, CrateLevel, template!(List: "name|name(args)"),
Gated( Gated(
Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None), Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None),
sym::plugin, sym::plugin,
"compiler plugins are deprecated and will be removed in 1.44.0", "compiler plugins are deprecated",
cfg_fn!(plugin) 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) { if attr::contains_name(&i.attrs[..], sym::plugin_registrar) {
gate_feature_post!(&self, plugin_registrar, i.span, gate_feature_post!(&self, plugin_registrar, i.span,
"compiler plugins are experimental and possibly buggy"); "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) { if attr::contains_name(&i.attrs[..], sym::start) {
gate_feature_post!(&self, start, i.span, gate_feature_post!(&self, start, i.span,

View file

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

View file

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

View file

@ -5,6 +5,6 @@
#![feature(plugin)] #![feature(plugin)]
#![plugin(rlib_crate_test)] #![plugin(rlib_crate_test)]
//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format //~^ 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() {} 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)] 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 --> $DIR/macro-crate-rlib.rs:6:1
| |
LL | #![plugin(rlib_crate_test)] LL | #![plugin(rlib_crate_test)]

View file

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

View file

@ -1,7 +1,7 @@
// Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate // Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate
#![plugin(foo)] #![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 //~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
fn main() {} 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 --> $DIR/feature-gate-plugin.rs:3:1
| |
LL | #![plugin(foo)] LL | #![plugin(foo)]
@ -7,7 +7,7 @@ LL | #![plugin(foo)]
= note: for more information, see https://github.com/rust-lang/rust/issues/29597 = note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add `#![feature(plugin)]` to the crate attributes to enable = 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 --> $DIR/feature-gate-plugin.rs:3:1
| |
LL | #![plugin(foo)] LL | #![plugin(foo)]

View file

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

View file

@ -1,5 +1,5 @@
error[E0658]: compiler plugins are experimental and possibly buggy 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() {} 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 = note: for more information, see https://github.com/rust-lang/rust/issues/29597
= help: add `#![feature(plugin_registrar)]` to the crate attributes to enable = help: add `#![feature(plugin_registrar)]` to the crate attributes to enable
warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 error[E0658]: compiler plugins are deprecated
--> $DIR/feature-gate-plugin_registrar.rs:6:1 --> $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`. For more information about this error, try `rustc --explain E0658`.

View file

@ -1,10 +1,8 @@
// ignore-tidy-linelength
#![deny(unused_attributes)] #![deny(unused_attributes)]
#![feature(plugin)] #![feature(plugin)]
#[plugin(bla)] //~ ERROR unused attribute #[plugin(bla)] //~ ERROR unused attribute
//~^ ERROR should be an inner 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() {} 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 warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/invalid-plugin-attr.rs:6:1 --> $DIR/invalid-plugin-attr.rs:4:1
| |
LL | #[plugin(bla)] LL | #[plugin(bla)]
| ^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^ help: remove this attribute
@ -7,19 +7,19 @@ LL | #[plugin(bla)]
= note: `#[warn(deprecated)]` on by default = note: `#[warn(deprecated)]` on by default
error: unused attribute error: unused attribute
--> $DIR/invalid-plugin-attr.rs:6:1 --> $DIR/invalid-plugin-attr.rs:4:1
| |
LL | #[plugin(bla)] LL | #[plugin(bla)]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
| |
note: lint level defined here note: lint level defined here
--> $DIR/invalid-plugin-attr.rs:3:9 --> $DIR/invalid-plugin-attr.rs:1:9
| |
LL | #![deny(unused_attributes)] LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` 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)] LL | #[plugin(bla)]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^

View file

@ -1,7 +1,5 @@
// ignore-tidy-linelength
#![feature(plugin)] #![feature(plugin)]
#![plugin] //~ ERROR malformed `plugin` attribute #![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() {} fn main() {}

View file

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

View file

@ -1,7 +1,5 @@
// ignore-tidy-linelength
#![feature(plugin)] #![feature(plugin)]
#![plugin="bleh"] //~ ERROR malformed `plugin` attribute #![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() {} fn main() {}

View file

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

View file

@ -1,7 +1,5 @@
// ignore-tidy-linelength
#![feature(plugin)] #![feature(plugin)]
#![plugin(foo="bleh")] //~ ERROR malformed `plugin` attribute #![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() {} fn main() {}

View file

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

View file

@ -1,14 +1,16 @@
warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0 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:7:1 --> $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 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:10:1 --> $DIR/multiple-plugin-registrars.rs:9:1
| |
LL | pub fn two() {} LL | #[plugin_registrar]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
error: multiple plugin registration functions found error: multiple plugin registration functions found
| |