Skip to content

Commit

Permalink
rustc_plugin: Remove support for adding plugins from command line
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Dec 1, 2019
1 parent 55ba05b commit db357a6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 27 deletions.
3 changes: 1 addition & 2 deletions src/librustc/lint/context.rs
Expand Up @@ -47,8 +47,7 @@ use rustc_error_codes::*;
/// This is basically the subset of `Context` that we can
/// build early in the compile pipeline.
pub struct LintStore {
/// Registered lints. The bool is true if the lint was
/// added by a plugin.
/// Registered lints.
lints: Vec<&'static Lint>,

/// Constructor functions for each variety of lint pass.
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/session/config.rs
Expand Up @@ -1364,8 +1364,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"enable queries of the dependency graph for regression testing"),
no_analysis: bool = (false, parse_bool, [UNTRACKED],
"parse and expand the source, but run no analysis"),
extra_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED],
"load extra plugins"),
unstable_options: bool = (false, parse_bool, [UNTRACKED],
"adds unstable command line options to rustc interface"),
force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
Expand Down
10 changes: 2 additions & 8 deletions src/librustc_interface/passes.rs
Expand Up @@ -106,8 +106,7 @@ declare_box_region_type!(
(&mut Resolver<'_>) -> (Result<ast::Crate>, ResolverOutputs)
);

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

let registrars = time(sess, "plugin loading", || {
plugin::load::load_plugins(
sess,
metadata_loader,
&krate,
Some(sess.opts.debugging_opts.extra_plugins.clone()),
)
plugin::load::load_plugins(sess, metadata_loader, &krate)
});

let mut lint_store = rustc_lint::new_lint_store(
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_interface/tests.rs
Expand Up @@ -650,10 +650,6 @@ fn test_debugging_options_tracking_hash() {
opts.debugging_opts.continue_parse_after_error = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

opts = reference.clone();
opts.debugging_opts.extra_plugins = vec![String::from("plugin1"), String::from("plugin2")];
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

opts = reference.clone();
opts.debugging_opts.force_overflow_checks = Some(true);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
Expand Down
11 changes: 3 additions & 8 deletions src/librustc_plugin_impl/load.rs
Expand Up @@ -28,10 +28,8 @@ fn call_malformed_plugin_attribute(sess: &Session, span: Span) {
/// Read plugin metadata and dynamically load registrar functions.
pub fn load_plugins(sess: &Session,
metadata_loader: &dyn MetadataLoader,
krate: &Crate,
addl_plugins: Option<Vec<String>>) -> Vec<PluginRegistrarFn> {
krate: &Crate) -> Vec<PluginRegistrarFn> {
let mut plugins = Vec::new();
let mut load_plugin = |ident| load_plugin(&mut plugins, sess, metadata_loader, ident);

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

for plugin in attr.meta_item_list().unwrap_or_default() {
match plugin.ident() {
Some(ident) if plugin.is_word() => load_plugin(ident),
Some(ident) if plugin.is_word() =>
load_plugin(&mut plugins, sess, metadata_loader, ident),
_ => call_malformed_plugin_attribute(sess, plugin.span()),
}
}
}

for plugin in addl_plugins.unwrap_or_default() {
load_plugin(Ident::from_str(&plugin));
}

plugins
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/ui-fulldeps/lint-plugin-cmdline-load.rs
@@ -1,9 +1,9 @@
// run-pass
// check-pass
// aux-build:lint-plugin-test.rs
// ignore-stage1
// compile-flags: -Z extra-plugins=lint_plugin_test
// compile-flags: -Z crate-attr=plugin(lint_plugin_test)

#![allow(dead_code)]
#![feature(plugin)]

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

Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr
@@ -1,3 +1,11 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> <crate attribute>:1:1
|
LL | plugin(lint_plugin_test)
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default

warning: item is named 'lintme'
--> $DIR/lint-plugin-cmdline-load.rs:8:1
|
Expand Down

0 comments on commit db357a6

Please sign in to comment.