Skip to content

Deprecate #![plugin] & #[plugin_registrar] #64675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/libsyntax/feature_gate/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,23 @@ 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_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",
cfg_fn!(plugin)
)
),

// Testing:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -64,15 +64,15 @@ 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)
}

fn join_codegen_and_link(
&self,
ongoing_codegen: Box<Any>,
ongoing_codegen: Box<dyn Any>,
sess: &Session,
_dep_graph: &DepGraph,
outputs: &OutputFilenames,
Expand All @@ -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)
}
3 changes: 2 additions & 1 deletion src/test/ui-fulldeps/gated-plugin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// aux-build:attr-plugin-test.rs

#![plugin(attr_plugin_test)]
//~^ ERROR compiler plugins are experimental and possibly buggy
//~^ ERROR compiler plugins are deprecated
//~| WARN use of deprecated attribute `plugin`: compiler plugins are deprecated

fn main() {}
10 changes: 9 additions & 1 deletion src/test/ui-fulldeps/gated-plugin.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0658]: compiler plugins are experimental and possibly buggy
error[E0658]: compiler plugins are deprecated
--> $DIR/gated-plugin.rs:3:1
|
LL | #![plugin(attr_plugin_test)]
Expand All @@ -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. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/gated-plugin.rs:3: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`.
1 change: 1 addition & 0 deletions src/test/ui-fulldeps/issue-15778-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

#![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay]
#![plugin(lint_for_crate)]
//~^ WARN use of deprecated attribute `plugin`

pub fn main() { }
9 changes: 9 additions & 0 deletions src/test/ui-fulldeps/issue-15778-fail.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/issue-15778-fail.rs:6:1
|
LL | #![plugin(lint_for_crate)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= 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() { }
| |_________________^
|
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/issue-15778-pass.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/issue-15778-pass.rs:8:1
|
LL | #![plugin(lint_for_crate_rpass)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/issue-40001.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/issue-40001.rs:6:1
|
LL | #![plugin(issue_40001_plugin)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

2 changes: 2 additions & 0 deletions src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// 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'

Expand Down
12 changes: 10 additions & 2 deletions src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/lint-group-plugin-deny-cmdline.rs:7:1
|
LL | #![plugin(lint_group_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

error: item is named 'lintme'
--> $DIR/lint-group-plugin-deny-cmdline.rs:8:1
--> $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:10:1
--> $DIR/lint-group-plugin-deny-cmdline.rs:12:1
|
LL | fn pleaselintme() { }
| ^^^^^^^^^^^^^^^^^^^^^
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-group-plugin.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/lint-group-plugin.rs:6:1
|
LL | #![plugin(lint_group_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

warning: item is named 'lintme'
--> $DIR/lint-group-plugin.rs:9:1
|
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/lint-plugin-cmdline-allow.rs:8:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

warning: function is never used: `lintme`
--> $DIR/lint-plugin-cmdline-allow.rs:10:1
|
Expand Down
1 change: 1 addition & 0 deletions src/test/ui-fulldeps/lint-plugin-deny-attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#![feature(plugin)]
#![plugin(lint_plugin_test)]
//~^ WARN use of deprecated attribute `plugin`
#![deny(test_lint)]

fn lintme() { } //~ ERROR item is named 'lintme'
Expand Down
12 changes: 10 additions & 2 deletions src/test/ui-fulldeps/lint-plugin-deny-attr.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/lint-plugin-deny-attr.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

error: item is named 'lintme'
--> $DIR/lint-plugin-deny-attr.rs:8:1
--> $DIR/lint-plugin-deny-attr.rs:9:1
|
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-plugin-deny-attr.rs:6:9
--> $DIR/lint-plugin-deny-attr.rs:7:9
|
LL | #![deny(test_lint)]
| ^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#![feature(plugin)]
#![plugin(lint_plugin_test)]
//~^ WARN use of deprecated attribute `plugin`

fn lintme() { } //~ ERROR item is named 'lintme'

Expand Down
10 changes: 9 additions & 1 deletion src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/lint-plugin-deny-cmdline.rs:6:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

error: item is named 'lintme'
--> $DIR/lint-plugin-deny-cmdline.rs:8:1
--> $DIR/lint-plugin-deny-cmdline.rs:9:1
|
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#![feature(plugin)]
#![plugin(lint_plugin_test)]
//~^ WARN use of deprecated attribute `plugin`
#![forbid(test_lint)]

fn lintme() { } //~ ERROR item is named 'lintme'
Expand Down
14 changes: 11 additions & 3 deletions src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
error[E0453]: allow(test_lint) overruled by outer forbid(test_lint)
--> $DIR/lint-plugin-forbid-attrs.rs:10:9
--> $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/issues/29597
--> $DIR/lint-plugin-forbid-attrs.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

error: item is named 'lintme'
--> $DIR/lint-plugin-forbid-attrs.rs:8:1
--> $DIR/lint-plugin-forbid-attrs.rs:9:1
|
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-plugin-forbid-attrs.rs:6:11
--> $DIR/lint-plugin-forbid-attrs.rs:7:11
|
LL | #![forbid(test_lint)]
| ^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#![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) overruled by outer forbid(test_lint)
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ LL | #[allow(test_lint)]
|
= 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/issues/29597
--> $DIR/lint-plugin-forbid-cmdline.rs:6:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

error: item is named 'lintme'
--> $DIR/lint-plugin-forbid-cmdline.rs:8:1
|
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-plugin.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/lint-plugin.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

warning: item is named 'lintme'
--> $DIR/lint-plugin.rs:8:1
|
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore
|
= note: requested on the command line with `-A test_lint`

warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/issues/29597
--> $DIR/lint-tool-cmdline-allow.rs:8:1
|
LL | #![plugin(lint_tool_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
= note: `#[warn(deprecated)]` on by default

warning: item is named 'lintme'
--> $DIR/lint-tool-cmdline-allow.rs:10:1
|
Expand Down
1 change: 1 addition & 0 deletions src/test/ui-fulldeps/lint-tool-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#![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
Expand Down
Loading