Skip to content

Commit d8d99ba

Browse files
committed
Auto merge of #62727 - SimonSapin:plugins-tls-dylib, r=petrochenkov
Deprecate using rustc_plugin without the rustc_driver dylib. CC #59800, 7198687 Fix #62717
2 parents c1b08dd + d0bbc60 commit d8d99ba

25 files changed

+52
-41
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,6 +3189,7 @@ dependencies = [
31893189
"rustc_interface",
31903190
"rustc_metadata",
31913191
"rustc_mir",
3192+
"rustc_plugin_impl",
31923193
"rustc_save_analysis",
31933194
"rustc_target",
31943195
"serialize",
@@ -3246,7 +3247,7 @@ dependencies = [
32463247
"rustc_metadata",
32473248
"rustc_mir",
32483249
"rustc_passes",
3249-
"rustc_plugin",
3250+
"rustc_plugin_impl",
32503251
"rustc_privacy",
32513252
"rustc_resolve",
32523253
"rustc_traits",
@@ -3372,7 +3373,7 @@ dependencies = [
33723373
]
33733374

33743375
[[package]]
3375-
name = "rustc_plugin"
3376+
name = "rustc_plugin_impl"
33763377
version = "0.0.0"
33773378
dependencies = [
33783379
"rustc",

src/doc/rustc-ux-guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ for details on how to format and write long error codes.
7070
[librustc_privacy](https://github.com/rust-lang/rust/blob/master/src/librustc_privacy/error_codes.rs),
7171
[librustc_resolve](https://github.com/rust-lang/rust/blob/master/src/librustc_resolve/error_codes.rs),
7272
[librustc_codegen_llvm](https://github.com/rust-lang/rust/blob/master/src/librustc_codegen_llvm/error_codes.rs),
73-
[librustc_plugin](https://github.com/rust-lang/rust/blob/master/src/librustc_plugin/error_codes.rs),
73+
[librustc_plugin_impl](https://github.com/rust-lang/rust/blob/master/src/librustc_plugin/error_codes.rs),
7474
[librustc_typeck](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/error_codes.rs).
7575
* Explanations have full markdown support. Use it, especially to highlight
7676
code with backticks.

src/doc/unstable-book/src/language-features/plugin.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extend the compiler's behavior with new syntax extensions, lint checks, etc.
1818
A plugin is a dynamic library crate with a designated *registrar* function that
1919
registers extensions with `rustc`. Other crates can load these extensions using
2020
the crate attribute `#![plugin(...)]`. See the
21-
`rustc_plugin` documentation for more about the
21+
`rustc_driver::plugin` documentation for more about the
2222
mechanics of defining and loading a plugin.
2323

2424
If present, arguments passed as `#![plugin(foo(... args ...))]` are not
@@ -54,13 +54,13 @@ that implements Roman numeral integer literals.
5454
extern crate syntax;
5555
extern crate syntax_pos;
5656
extern crate rustc;
57-
extern crate rustc_plugin;
57+
extern crate rustc_driver;
5858
5959
use syntax::parse::token::{self, Token};
6060
use syntax::tokenstream::TokenTree;
6161
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
6262
use syntax_pos::Span;
63-
use rustc_plugin::Registry;
63+
use rustc_driver::plugin::Registry;
6464
6565
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
6666
-> Box<dyn MacResult + 'static> {
@@ -180,11 +180,11 @@ extern crate syntax;
180180
// Load rustc as a plugin to get macros
181181
#[macro_use]
182182
extern crate rustc;
183-
extern crate rustc_plugin;
183+
extern crate rustc_driver;
184184
185185
use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass,
186186
EarlyLintPassObject, LintArray};
187-
use rustc_plugin::Registry;
187+
use rustc_driver::plugin::Registry;
188188
use syntax::ast;
189189
190190
declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'");

src/librustc_driver/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ rustc_data_structures = { path = "../librustc_data_structures" }
2020
errors = { path = "../librustc_errors", package = "rustc_errors" }
2121
rustc_metadata = { path = "../librustc_metadata" }
2222
rustc_mir = { path = "../librustc_mir" }
23+
rustc_plugin_impl = { path = "../librustc_plugin" }
2324
rustc_save_analysis = { path = "../librustc_save_analysis" }
2425
rustc_codegen_utils = { path = "../librustc_codegen_utils" }
2526
rustc_interface = { path = "../librustc_interface" }

src/librustc_driver/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ extern crate libc;
2222
#[macro_use]
2323
extern crate log;
2424

25+
pub extern crate rustc_plugin_impl as plugin;
26+
2527
use pretty::{PpMode, UserIdentifiedItem};
2628

2729
//use rustc_resolve as resolve;

src/librustc_interface/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rustc_passes = { path = "../librustc_passes" }
3030
rustc_typeck = { path = "../librustc_typeck" }
3131
rustc_lint = { path = "../librustc_lint" }
3232
rustc_errors = { path = "../librustc_errors" }
33-
rustc_plugin = { path = "../librustc_plugin" }
33+
rustc_plugin = { path = "../librustc_plugin", package = "rustc_plugin_impl" }
3434
rustc_privacy = { path = "../librustc_privacy" }
3535
rustc_resolve = { path = "../librustc_resolve" }
3636
tempfile = "3.0.5"

src/librustc_lint/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This currently only contains the definitions and implementations
44
//! of most of the lints that `rustc` supports directly, it does not
55
//! contain the infrastructure for defining/registering lints. That is
6-
//! available in `rustc::lint` and `rustc_plugin` respectively.
6+
//! available in `rustc::lint` and `rustc_driver::plugin` respectively.
77
//!
88
//! ## Note
99
//!

src/librustc_plugin/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
authors = ["The Rust Project Developers"]
3-
name = "rustc_plugin"
3+
name = "rustc_plugin_impl"
44
version = "0.0.0"
55
build = false
66
edition = "2018"
77

88
[lib]
9-
name = "rustc_plugin"
9+
name = "rustc_plugin_impl"
1010
path = "lib.rs"
1111
doctest = false
1212

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
authors = ["The Rust Project Developers"]
3+
name = "rustc_plugin"
4+
version = "0.0.0"
5+
build = false
6+
edition = "2018"
7+
8+
[lib]
9+
name = "rustc_plugin"
10+
path = "lib.rs"
11+
doctest = false
12+
13+
[dependencies]
14+
rustc_plugin_impl = { path = ".." }

src/librustc_plugin/deprecated/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
2+
#![feature(staged_api)]
3+
#![unstable(feature = "rustc_plugin", issue = "29597")]
4+
#![rustc_deprecated(since = "1.38.0", reason = "\
5+
import this through `rustc_driver::plugin` instead to make TLS work correctly. \
6+
See https://github.com/rust-lang/rust/issues/62717")]
7+
8+
pub use rustc_plugin_impl::*;

0 commit comments

Comments
 (0)