Skip to content

Commit db357a6

Browse files
committed
rustc_plugin: Remove support for adding plugins from command line
1 parent 55ba05b commit db357a6

File tree

7 files changed

+17
-27
lines changed

7 files changed

+17
-27
lines changed

src/librustc/lint/context.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ use rustc_error_codes::*;
4747
/// This is basically the subset of `Context` that we can
4848
/// build early in the compile pipeline.
4949
pub struct LintStore {
50-
/// Registered lints. The bool is true if the lint was
51-
/// added by a plugin.
50+
/// Registered lints.
5251
lints: Vec<&'static Lint>,
5352

5453
/// Constructor functions for each variety of lint pass.

src/librustc/session/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,8 +1364,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13641364
"enable queries of the dependency graph for regression testing"),
13651365
no_analysis: bool = (false, parse_bool, [UNTRACKED],
13661366
"parse and expand the source, but run no analysis"),
1367-
extra_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED],
1368-
"load extra plugins"),
13691367
unstable_options: bool = (false, parse_bool, [UNTRACKED],
13701368
"adds unstable command line options to rustc interface"),
13711369
force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],

src/librustc_interface/passes.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ declare_box_region_type!(
106106
(&mut Resolver<'_>) -> (Result<ast::Crate>, ResolverOutputs)
107107
);
108108

109-
/// Runs the "early phases" of the compiler: initial `cfg` processing,
110-
/// loading compiler plugins (including those from `addl_plugins`),
109+
/// Runs the "early phases" of the compiler: initial `cfg` processing, loading compiler plugins,
111110
/// syntax expansion, secondary `cfg` expansion, synthesis of a test
112111
/// harness if one is to be provided, injection of a dependency on the
113112
/// standard library and prelude, and name resolution.
@@ -210,12 +209,7 @@ pub fn register_plugins<'a>(
210209
});
211210

212211
let registrars = time(sess, "plugin loading", || {
213-
plugin::load::load_plugins(
214-
sess,
215-
metadata_loader,
216-
&krate,
217-
Some(sess.opts.debugging_opts.extra_plugins.clone()),
218-
)
212+
plugin::load::load_plugins(sess, metadata_loader, &krate)
219213
});
220214

221215
let mut lint_store = rustc_lint::new_lint_store(

src/librustc_interface/tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,6 @@ fn test_debugging_options_tracking_hash() {
650650
opts.debugging_opts.continue_parse_after_error = true;
651651
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
652652

653-
opts = reference.clone();
654-
opts.debugging_opts.extra_plugins = vec![String::from("plugin1"), String::from("plugin2")];
655-
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
656-
657653
opts = reference.clone();
658654
opts.debugging_opts.force_overflow_checks = Some(true);
659655
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

src/librustc_plugin_impl/load.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ fn call_malformed_plugin_attribute(sess: &Session, span: Span) {
2828
/// Read plugin metadata and dynamically load registrar functions.
2929
pub fn load_plugins(sess: &Session,
3030
metadata_loader: &dyn MetadataLoader,
31-
krate: &Crate,
32-
addl_plugins: Option<Vec<String>>) -> Vec<PluginRegistrarFn> {
31+
krate: &Crate) -> Vec<PluginRegistrarFn> {
3332
let mut plugins = Vec::new();
34-
let mut load_plugin = |ident| load_plugin(&mut plugins, sess, metadata_loader, ident);
3533

3634
for attr in &krate.attrs {
3735
if !attr.check_name(sym::plugin) {
@@ -40,16 +38,13 @@ pub fn load_plugins(sess: &Session,
4038

4139
for plugin in attr.meta_item_list().unwrap_or_default() {
4240
match plugin.ident() {
43-
Some(ident) if plugin.is_word() => load_plugin(ident),
41+
Some(ident) if plugin.is_word() =>
42+
load_plugin(&mut plugins, sess, metadata_loader, ident),
4443
_ => call_malformed_plugin_attribute(sess, plugin.span()),
4544
}
4645
}
4746
}
4847

49-
for plugin in addl_plugins.unwrap_or_default() {
50-
load_plugin(Ident::from_str(&plugin));
51-
}
52-
5348
plugins
5449
}
5550

src/test/ui-fulldeps/lint-plugin-cmdline-load.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// run-pass
1+
// check-pass
22
// aux-build:lint-plugin-test.rs
33
// ignore-stage1
4-
// compile-flags: -Z extra-plugins=lint_plugin_test
4+
// compile-flags: -Z crate-attr=plugin(lint_plugin_test)
55

6-
#![allow(dead_code)]
6+
#![feature(plugin)]
77

88
fn lintme() { } //~ WARNING item is named 'lintme'
99

src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
2+
--> <crate attribute>:1:1
3+
|
4+
LL | plugin(lint_plugin_test)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
6+
|
7+
= note: `#[warn(deprecated)]` on by default
8+
19
warning: item is named 'lintme'
210
--> $DIR/lint-plugin-cmdline-load.rs:8:1
311
|

0 commit comments

Comments
 (0)