Skip to content

Commit

Permalink
Auto merge of #13248 - bjorn3:deprecate_plugin, r=weihanglo
Browse files Browse the repository at this point in the history
Deprecate rustc plugin support in cargo
  • Loading branch information
bors committed Jan 4, 2024
2 parents f9946d1 + f26e2fe commit a885354
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/cargo/util/toml/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ fn clean_lib(
}
};

if lib.plugin == Some(true) {
warnings.push(format!(
"support for rustc plugins has been removed from rustc. \
library `{}` should not specify `plugin = true`",
name_or_panic(lib)
));
warnings.push(format!(
"support for `plugin = true` will be removed from cargo in the future"
));
}

// Per the Macros 1.1 RFC:
//
// > Initially if a crate is compiled with the `proc-macro` crate type
Expand Down
2 changes: 2 additions & 0 deletions tests/testsuite/cross_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,8 @@ fn plugin_build_script_right_arch() {
.arg(cross_compile::alternate())
.with_stderr(
"\
[WARNING] support for rustc plugins has been removed from rustc. library `foo` should not specify `plugin = true`
[WARNING] support for `plugin = true` will be removed from cargo in the future
[COMPILING] foo v0.0.1 ([..])
[RUNNING] `rustc [..] build.rs [..]`
[RUNNING] `[..]/build-script-build`
Expand Down
5 changes: 5 additions & 0 deletions tests/testsuite/proc_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ fn proc_macro_crate_type_warning_plugin() {
.build();

foo.cargo("check")
.with_stderr_contains(
"[WARNING] support for rustc plugins has been removed from rustc. \
library `foo` should not specify `plugin = true`")
.with_stderr_contains(
"[WARNING] support for `plugin = true` will be removed from cargo in the future")
.with_stderr_contains(
"[WARNING] proc-macro library `foo` should not specify `plugin = true`")
.with_stderr_contains(
Expand Down

0 comments on commit a885354

Please sign in to comment.