rustc_plugin: Remove support for adding plugins from command line

This commit is contained in:
Vadim Petrochenkov 2019-11-30 11:31:25 +03:00
parent 55ba05bd0d
commit db357a6e3b
7 changed files with 17 additions and 27 deletions

View File

@ -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.

View File

@ -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],

View File

@ -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.
@ -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(

View File

@ -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());

View File

@ -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) {
@ -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
}

View File

@ -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'

View File

@ -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
|