Skip to content

Commit

Permalink
Remove ability for plugins to register a MIR pass
Browse files Browse the repository at this point in the history
In recent months there have been a few different people investigating how to make a plugin that
registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper.

The interface to register MIR passes was added primarily for miri (& later was
found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use
this interface anymore it seems like a good time to remove this "feature".

For prototyping purposes a similar interface can be added by developers themselves in their custom
rustc build.
  • Loading branch information
nagisa authored and alexcrichton committed Mar 10, 2017
1 parent f573db4 commit 4ca9c97
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 91 deletions.
3 changes: 1 addition & 2 deletions src/librustc_driver/driver.rs
Expand Up @@ -604,7 +604,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,

let whitelisted_legacy_custom_derives = registry.take_whitelisted_custom_derives();
let Registry { syntax_exts, early_lint_passes, late_lint_passes, lint_groups,
llvm_passes, attributes, mir_passes, .. } = registry;
llvm_passes, attributes, .. } = registry;

sess.track_errors(|| {
let mut ls = sess.lint_store.borrow_mut();
Expand All @@ -620,7 +620,6 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
}

*sess.plugin_llvm_passes.borrow_mut() = llvm_passes;
sess.mir_passes.borrow_mut().extend(mir_passes);
*sess.plugin_attributes.borrow_mut() = attributes.clone();
})?;

Expand Down
11 changes: 0 additions & 11 deletions src/librustc_plugin/registry.rs
Expand Up @@ -13,8 +13,6 @@
use rustc::lint::{EarlyLintPassObject, LateLintPassObject, LintId, Lint};
use rustc::session::Session;

use rustc::mir::transform::MirMapPass;

use syntax::ext::base::{SyntaxExtension, NamedSyntaxExtension, NormalTT, IdentTT};
use syntax::ext::base::MacroExpanderFn;
use syntax::symbol::Symbol;
Expand Down Expand Up @@ -53,9 +51,6 @@ pub struct Registry<'a> {
#[doc(hidden)]
pub late_lint_passes: Vec<LateLintPassObject>,

#[doc(hidden)]
pub mir_passes: Vec<Box<for<'pcx> MirMapPass<'pcx>>>,

#[doc(hidden)]
pub lint_groups: HashMap<&'static str, Vec<LintId>>,

Expand All @@ -81,7 +76,6 @@ impl<'a> Registry<'a> {
lint_groups: HashMap::new(),
llvm_passes: vec![],
attributes: vec![],
mir_passes: Vec::new(),
whitelisted_custom_derives: Vec::new(),
}
}
Expand Down Expand Up @@ -157,11 +151,6 @@ impl<'a> Registry<'a> {
self.lint_groups.insert(name, to.into_iter().map(|x| LintId::of(x)).collect());
}

/// Register a MIR pass
pub fn register_mir_pass(&mut self, pass: Box<for<'pcx> MirMapPass<'pcx>>) {
self.mir_passes.push(pass);
}

/// Register an LLVM pass.
///
/// Registration with LLVM itself is handled through static C++ objects with
Expand Down
55 changes: 0 additions & 55 deletions src/test/run-pass-fulldeps/auxiliary/dummy_mir_pass.rs

This file was deleted.

23 changes: 0 additions & 23 deletions src/test/run-pass-fulldeps/mir-pass.rs

This file was deleted.

0 comments on commit 4ca9c97

Please sign in to comment.