mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
Deprecate #![plugin]
and #[plugin_registrar]
.
This commit is contained in:
parent
2daa404e9a
commit
287ceed469
@ -279,9 +279,14 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||||||
|
|
||||||
// Plugins:
|
// Plugins:
|
||||||
ungated!(plugin_registrar, Normal, template!(Word)),
|
ungated!(plugin_registrar, Normal, template!(Word)),
|
||||||
gated!(
|
(
|
||||||
plugin, CrateLevel, template!(List: "name|name(args)"),
|
sym::plugin, CrateLevel, template!(List: "name|name(args)"),
|
||||||
"compiler plugins are experimental and possibly buggy",
|
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:
|
// Testing:
|
||||||
|
@ -311,6 +311,10 @@ 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,
|
||||||
|
@ -41,7 +41,7 @@ impl MetadataLoader for NoLlvmMetadataLoader {
|
|||||||
struct TheBackend;
|
struct TheBackend;
|
||||||
|
|
||||||
impl CodegenBackend for TheBackend {
|
impl CodegenBackend for TheBackend {
|
||||||
fn metadata_loader(&self) -> Box<MetadataLoader + Sync> {
|
fn metadata_loader(&self) -> Box<dyn MetadataLoader + Sync> {
|
||||||
Box::new(NoLlvmMetadataLoader)
|
Box::new(NoLlvmMetadataLoader)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ impl CodegenBackend for TheBackend {
|
|||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
_metadata: EncodedMetadata,
|
_metadata: EncodedMetadata,
|
||||||
_need_metadata_module: bool,
|
_need_metadata_module: bool,
|
||||||
) -> Box<Any> {
|
) -> Box<dyn Any> {
|
||||||
use rustc::hir::def_id::LOCAL_CRATE;
|
use rustc::hir::def_id::LOCAL_CRATE;
|
||||||
|
|
||||||
Box::new(tcx.crate_name(LOCAL_CRATE) as Symbol)
|
Box::new(tcx.crate_name(LOCAL_CRATE) as Symbol)
|
||||||
@ -72,7 +72,7 @@ impl CodegenBackend for TheBackend {
|
|||||||
|
|
||||||
fn join_codegen_and_link(
|
fn join_codegen_and_link(
|
||||||
&self,
|
&self,
|
||||||
ongoing_codegen: Box<Any>,
|
ongoing_codegen: Box<dyn Any>,
|
||||||
sess: &Session,
|
sess: &Session,
|
||||||
_dep_graph: &DepGraph,
|
_dep_graph: &DepGraph,
|
||||||
outputs: &OutputFilenames,
|
outputs: &OutputFilenames,
|
||||||
@ -97,6 +97,6 @@ impl CodegenBackend for TheBackend {
|
|||||||
|
|
||||||
/// This is the entrypoint for a hot plugged rustc_codegen_llvm
|
/// This is the entrypoint for a hot plugged rustc_codegen_llvm
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn __rustc_codegen_backend() -> Box<CodegenBackend> {
|
pub fn __rustc_codegen_backend() -> Box<dyn CodegenBackend> {
|
||||||
Box::new(TheBackend)
|
Box::new(TheBackend)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
// 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 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() {}
|
fn main() {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0658]: compiler plugins are experimental and possibly buggy
|
error[E0658]: compiler plugins are deprecated and will be removed in 1.44.0
|
||||||
--> $DIR/gated-plugin.rs:3:1
|
--> $DIR/gated-plugin.rs:4:1
|
||||||
|
|
|
|
||||||
LL | #![plugin(attr_plugin_test)]
|
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
|
= 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
|
||||||
|
--> $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
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
@ -5,5 +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
|
||||||
|
|
||||||
fn main() {}
|
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)]
|
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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,6 +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 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() {}
|
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
|
--> $DIR/feature-gate-plugin.rs:3:1
|
||||||
|
|
|
|
||||||
LL | #![plugin(foo)]
|
LL | #![plugin(foo)]
|
||||||
@ -7,6 +7,14 @@ 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
|
||||||
|
--> $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
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
@ -5,4 +5,6 @@
|
|||||||
#[plugin_registrar]
|
#[plugin_registrar]
|
||||||
pub fn registrar() {}
|
pub fn registrar() {}
|
||||||
//~^ ERROR compiler plugins are experimental
|
//~^ ERROR compiler plugins are experimental
|
||||||
|
//~| WARN `#[plugin_registrar]` is deprecated and will be removed in 1.44.0
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -7,6 +7,12 @@ 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
|
||||||
|
--> $DIR/feature-gate-plugin_registrar.rs:6:1
|
||||||
|
|
|
||||||
|
LL | pub fn registrar() {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
// 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
|
||||||
|
|
||||||
fn main() {}
|
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
|
error: unused attribute
|
||||||
--> $DIR/invalid-plugin-attr.rs:4:1
|
--> $DIR/invalid-plugin-attr.rs:6:1
|
||||||
|
|
|
|
||||||
LL | #[plugin(bla)]
|
LL | #[plugin(bla)]
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/invalid-plugin-attr.rs:1:9
|
--> $DIR/invalid-plugin-attr.rs:3: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:4:1
|
--> $DIR/invalid-plugin-attr.rs:6:1
|
||||||
|
|
|
|
||||||
LL | #[plugin(bla)]
|
LL | #[plugin(bla)]
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
// 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
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
error: malformed `plugin` attribute input
|
error: malformed `plugin` attribute input
|
||||||
--> $DIR/malformed-plugin-1.rs:2:1
|
--> $DIR/malformed-plugin-1.rs:4: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
|
||||||
|
--> $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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
// 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
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
error: malformed `plugin` attribute input
|
error: malformed `plugin` attribute input
|
||||||
--> $DIR/malformed-plugin-2.rs:2:1
|
--> $DIR/malformed-plugin-2.rs:4: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
|
||||||
|
--> $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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
// 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
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
error[E0498]: malformed `plugin` attribute
|
error[E0498]: malformed `plugin` attribute
|
||||||
--> $DIR/malformed-plugin-3.rs:2:1
|
--> $DIR/malformed-plugin-3.rs:4: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
|
||||||
|
--> $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
|
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
|
error: multiple plugin registration functions found
|
||||||
|
|
|
|
||||||
note: one is here
|
note: one is here
|
||||||
|
Loading…
Reference in New Issue
Block a user