Deprecate #![plugin]
and #[plugin_registrar]
.
This commit is contained in:
parent
2daa404e9a
commit
287ceed469
20 changed files with 119 additions and 18 deletions
|
@ -279,9 +279,14 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
|
||||
// Plugins:
|
||||
ungated!(plugin_registrar, Normal, template!(Word)),
|
||||
gated!(
|
||||
plugin, CrateLevel, template!(List: "name|name(args)"),
|
||||
"compiler plugins are experimental and possibly buggy",
|
||||
(
|
||||
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",
|
||||
cfg_fn!(plugin)
|
||||
)
|
||||
),
|
||||
|
||||
// Testing:
|
||||
|
|
|
@ -311,6 +311,10 @@ 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,
|
||||
|
|
|
@ -41,7 +41,7 @@ impl MetadataLoader for NoLlvmMetadataLoader {
|
|||
struct TheBackend;
|
||||
|
||||
impl CodegenBackend for TheBackend {
|
||||
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
|
||||
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
|
||||
Box::new(NoLlvmMetadataLoader)
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ impl CodegenBackend for TheBackend {
|
|||
tcx: TyCtxt<'tcx>,
|
||||
_metadata: EncodedMetadata,
|
||||
_need_metadata_module: bool,
|
||||
) -> Box<Any> {
|
||||
) -> Box<dyn Any> {
|
||||
use rustc::hir::def_id::LOCAL_CRATE;
|
||||
|
||||
Box::new(tcx.crate_name(LOCAL_CRATE) as Symbol)
|
||||
|
@ -72,7 +72,7 @@ impl CodegenBackend for TheBackend {
|
|||
|
||||
fn join_codegen_and_link(
|
||||
&self,
|
||||
ongoing_codegen: Box<Any>,
|
||||
ongoing_codegen: Box<dyn Any>,
|
||||
sess: &Session,
|
||||
_dep_graph: &DepGraph,
|
||||
outputs: &OutputFilenames,
|
||||
|
@ -97,6 +97,6 @@ impl CodegenBackend for TheBackend {
|
|||
|
||||
/// This is the entrypoint for a hot plugged rustc_codegen_llvm
|
||||
#[no_mangle]
|
||||
pub fn __rustc_codegen_backend() -> Box<CodegenBackend> {
|
||||
pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
|
||||
Box::new(TheBackend)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// ignore-tidy-linelength
|
||||
// aux-build:attr-plugin-test.rs
|
||||
|
||||
#![plugin(attr_plugin_test)]
|
||||
//~^ ERROR compiler plugins are experimental and possibly buggy
|
||||
//~^ 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
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0658]: compiler plugins are experimental and possibly buggy
|
||||
--> $DIR/gated-plugin.rs:3:1
|
||||
error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0
|
||||
--> $DIR/gated-plugin.rs:4:1
|
||||
|
|
||||
LL | #![plugin(attr_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -7,6 +7,14 @@ 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
|
||||
|
|
||||
LL | #![plugin(attr_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -5,5 +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
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -4,5 +4,13 @@ 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
|
||||
--> $DIR/macro-crate-rlib.rs:6:1
|
||||
|
|
||||
LL | #![plugin(rlib_crate_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate
|
||||
|
||||
#![plugin(foo)]
|
||||
//~^ ERROR compiler plugins are experimental and possibly buggy
|
||||
//~^ ERROR compiler plugins are deprecated and will be removed in 1.44.0
|
||||
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
error[E0658]: compiler plugins are experimental and possibly buggy
|
||||
error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0
|
||||
--> $DIR/feature-gate-plugin.rs:3:1
|
||||
|
|
||||
LL | #![plugin(foo)]
|
||||
|
@ -7,6 +7,14 @@ 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
|
||||
--> $DIR/feature-gate-plugin.rs:3:1
|
||||
|
|
||||
LL | #![plugin(foo)]
|
||||
| ^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -5,4 +5,6 @@
|
|||
#[plugin_registrar]
|
||||
pub fn registrar() {}
|
||||
//~^ ERROR compiler plugins are experimental
|
||||
//~| WARN `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -7,6 +7,12 @@ 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
|
||||
|
|
||||
LL | pub fn registrar() {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
// 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
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
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
|
||||
|
|
||||
LL | #[plugin(bla)]
|
||||
| ^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: unused attribute
|
||||
--> $DIR/invalid-plugin-attr.rs:4:1
|
||||
--> $DIR/invalid-plugin-attr.rs:6:1
|
||||
|
|
||||
LL | #[plugin(bla)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/invalid-plugin-attr.rs:1:9
|
||||
--> $DIR/invalid-plugin-attr.rs:3:9
|
||||
|
|
||||
LL | #![deny(unused_attributes)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
|
||||
--> $DIR/invalid-plugin-attr.rs:4:1
|
||||
--> $DIR/invalid-plugin-attr.rs:6:1
|
||||
|
|
||||
LL | #[plugin(bla)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
// 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
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
error: malformed `plugin` attribute input
|
||||
--> $DIR/malformed-plugin-1.rs:2:1
|
||||
--> $DIR/malformed-plugin-1.rs:4: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
|
||||
|
|
||||
LL | #![plugin]
|
||||
| ^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
// 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
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
error: malformed `plugin` attribute input
|
||||
--> $DIR/malformed-plugin-2.rs:2:1
|
||||
--> $DIR/malformed-plugin-2.rs:4: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
|
||||
|
|
||||
LL | #![plugin="bleh"]
|
||||
| ^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
// 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
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
error[E0498]: malformed `plugin` attribute
|
||||
--> $DIR/malformed-plugin-3.rs:2:1
|
||||
--> $DIR/malformed-plugin-3.rs:4: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
|
||||
|
|
||||
LL | #![plugin(foo="bleh")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
|
||||
--> $DIR/multiple-plugin-registrars.rs:7:1
|
||||
|
|
||||
LL | pub fn one() {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
warning: `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
|
||||
--> $DIR/multiple-plugin-registrars.rs:10:1
|
||||
|
|
||||
LL | pub fn two() {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: multiple plugin registration functions found
|
||||
|
|
||||
note: one is here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue