diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 74ba83d0ee4..f673ea3e771 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -76,7 +76,6 @@ pub struct Session { /// (sub)diagnostics that have been set once, but should not be set again, /// in order to avoid redundantly verbose output (Issue #24690, #44953). pub one_time_diagnostics: Lock, String)>>, - pub plugin_llvm_passes: OneThread>>, pub crate_types: Once>, /// The `crate_disambiguator` is constructed out of all the `-C metadata` /// arguments passed to the compiler. Its value together with the crate-name @@ -1149,7 +1148,6 @@ fn build_session_( local_crate_source_file, working_dir, one_time_diagnostics: Default::default(), - plugin_llvm_passes: OneThread::new(RefCell::new(Vec::new())), crate_types: Once::new(), crate_disambiguator: Once::new(), features: Once::new(), diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index 5dfb04a4436..07ac76cec99 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -365,20 +365,6 @@ pub(crate) unsafe fn optimize(cgcx: &CodegenContext, add_sanitizer_passes(config, &mut extra_passes); - for pass_name in &cgcx.plugin_passes { - if let Some(pass) = find_pass(pass_name) { - extra_passes.push(pass); - } else { - diag_handler.err(&format!("a plugin asked for LLVM pass \ - `{}` but LLVM does not \ - recognize it", pass_name)); - } - - if pass_name == "name-anon-globals" { - have_name_anon_globals_pass = true; - } - } - // Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need // to make sure we run LLVM's NameAnonGlobals pass when emitting bitcode; otherwise // we'll get errors in LLVM. diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 9d3e57449f8..863b41ec15e 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -231,8 +231,6 @@ pub struct CodegenContext { pub total_cgus: usize, // Handler to use for diagnostics produced during codegen. pub diag_emitter: SharedEmitter, - // LLVM passes added by plugins. - pub plugin_passes: Vec, // LLVM optimizations for which we want to print remarks. pub remark: Passes, // Worker thread number @@ -1028,7 +1026,6 @@ fn start_executing_work( time_passes: sess.time_extended(), prof: sess.prof.clone(), exported_symbols, - plugin_passes: sess.plugin_llvm_passes.borrow().clone(), remark: sess.opts.cg.remark.clone(), worker: 0, incr_comp_session_dir: sess.incr_comp_session_dir_opt().map(|r| r.clone()), diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index e752a5eab4e..7ed1d12666f 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -208,27 +208,22 @@ pub fn register_plugins<'a>( middle::recursion_limit::update_limits(sess, &krate); }); - let registrars = time(sess, "plugin loading", || { - plugin::load::load_plugins(sess, metadata_loader, &krate) - }); - let mut lint_store = rustc_lint::new_lint_store( sess.opts.debugging_opts.no_interleave_lints, sess.unstable_options(), ); + register_lints(&sess, &mut lint_store); - (register_lints)(&sess, &mut lint_store); - - let mut registry = Registry::new(sess, &mut lint_store, krate.span); - + let registrars = time(sess, "plugin loading", || { + plugin::load::load_plugins(sess, metadata_loader, &krate) + }); time(sess, "plugin registration", || { + let mut registry = Registry::new(sess, &mut lint_store, krate.span); for registrar in registrars { registrar(&mut registry); } }); - *sess.plugin_llvm_passes.borrow_mut() = registry.llvm_passes; - Ok((krate, Lrc::new(lint_store))) } diff --git a/src/librustc_plugin_impl/registry.rs b/src/librustc_plugin_impl/registry.rs index 91e6901ff50..fb749050756 100644 --- a/src/librustc_plugin_impl/registry.rs +++ b/src/librustc_plugin_impl/registry.rs @@ -4,8 +4,6 @@ use rustc::lint::LintStore; use rustc::session::Session; use syntax_pos::Span; -use std::borrow::ToOwned; - /// Structure used to register plugins. /// /// A plugin registrar function takes an `&mut Registry` and should call @@ -24,9 +22,6 @@ pub struct Registry<'a> { #[doc(hidden)] pub krate_span: Span, - - #[doc(hidden)] - pub llvm_passes: Vec, } impl<'a> Registry<'a> { @@ -36,16 +31,6 @@ impl<'a> Registry<'a> { sess, lint_store, krate_span, - llvm_passes: vec![], } } - - /// Register an LLVM pass. - /// - /// Registration with LLVM itself is handled through static C++ objects with - /// constructors. This method simply adds a name to the list of passes to - /// execute. - pub fn register_llvm_pass(&mut self, name: &str) { - self.llvm_passes.push(name.to_owned()); - } } diff --git a/src/test/ui-fulldeps/auxiliary/llvm-pass-plugin.rs b/src/test/ui-fulldeps/auxiliary/llvm-pass-plugin.rs deleted file mode 100644 index 2ff1c2e363d..00000000000 --- a/src/test/ui-fulldeps/auxiliary/llvm-pass-plugin.rs +++ /dev/null @@ -1,19 +0,0 @@ -// force-host - -#![feature(plugin_registrar)] -#![feature(rustc_private)] - -extern crate rustc; -extern crate rustc_driver; - -use rustc_driver::plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - // This pass is built in to LLVM. - // - // Normally, we would name a pass that was registered through - // C++ static object constructors in the same .so file as the - // plugin registrar. - reg.register_llvm_pass("gvn"); -} diff --git a/src/test/ui-fulldeps/llvm-pass-plugin.rs b/src/test/ui-fulldeps/llvm-pass-plugin.rs deleted file mode 100644 index fa5cbc1e808..00000000000 --- a/src/test/ui-fulldeps/llvm-pass-plugin.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -// aux-build:llvm-pass-plugin.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(llvm_pass_plugin)] //~ WARNING compiler plugins are deprecated - -pub fn main() { } diff --git a/src/test/ui-fulldeps/llvm-pass-plugin.stderr b/src/test/ui-fulldeps/llvm-pass-plugin.stderr deleted file mode 100644 index 61b53bb2b7c..00000000000 --- a/src/test/ui-fulldeps/llvm-pass-plugin.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/llvm-pass-plugin.rs:6:1 - | -LL | #![plugin(llvm_pass_plugin)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version - | - = note: `#[warn(deprecated)]` on by default -