rustc_plugin: Some further cleanup

Remove a useless test
This commit is contained in:
Vadim Petrochenkov 2019-11-30 15:35:25 +03:00
parent 279937812a
commit e5944a5a69
8 changed files with 15 additions and 62 deletions

View file

@ -30,7 +30,6 @@ use rustc_mir as mir;
use rustc_parse::{parse_crate_from_file, parse_crate_from_source_str};
use rustc_passes::{self, ast_validation, hir_stats, layout_test};
use rustc_plugin_impl as plugin;
use rustc_plugin_impl::registry::Registry;
use rustc_privacy;
use rustc_resolve::{Resolver, ResolverArenas};
use rustc_traits;
@ -218,7 +217,7 @@ pub fn register_plugins<'a>(
plugin::load::load_plugins(sess, metadata_loader, &krate)
});
time(sess, "plugin registration", || {
let mut registry = Registry::new(sess, &mut lint_store, krate.span);
let mut registry = plugin::Registry { lint_store: &mut lint_store };
for registrar in registrars {
registrar(&mut registry);
}

View file

@ -10,10 +10,16 @@
#![feature(nll)]
#![recursion_limit="256"]
use rustc::lint::LintStore;
pub use registry::Registry;
pub mod registry;
pub mod load;
pub mod build;
pub mod load;
/// Structure used to register plugins.
///
/// A plugin registrar function takes an `&mut Registry` and should call
/// methods to register its plugins.
pub struct Registry<'a> {
/// The `LintStore` allows plugins to register new lints.
pub lint_store: &'a mut LintStore,
}

View file

@ -3,7 +3,7 @@
use rustc::middle::cstore::MetadataLoader;
use rustc::session::Session;
use rustc_metadata::locator;
use crate::registry::Registry;
use crate::Registry;
use std::borrow::ToOwned;
use std::env;

View file

@ -1,36 +0,0 @@
//! Used by plugin crates to tell `rustc` about the plugins they provide.
use rustc::lint::LintStore;
use rustc::session::Session;
use syntax_pos::Span;
/// Structure used to register plugins.
///
/// A plugin registrar function takes an `&mut Registry` and should call
/// methods to register its plugins.
///
/// This struct has public fields and other methods for use by `rustc`
/// itself. They are not documented here, and plugin authors should
/// not use them.
pub struct Registry<'a> {
/// Compiler session. Useful if you want to emit diagnostic messages
/// from the plugin registrar.
pub sess: &'a Session,
/// The `LintStore` allows plugins to register new lints.
pub lint_store: &'a mut LintStore,
#[doc(hidden)]
pub krate_span: Span,
}
impl<'a> Registry<'a> {
#[doc(hidden)]
pub fn new(sess: &'a Session, lint_store: &'a mut LintStore, krate_span: Span) -> Registry<'a> {
Registry {
sess,
lint_store,
krate_span,
}
}
}

View file

@ -1,8 +0,0 @@
// check-pass
// aux-build:empty-plugin.rs
// ignore-stage1
#![feature(plugin)]
#![plugin(empty_plugin)] //~ WARNING compiler plugins are deprecated
fn main() {}

View file

@ -1,8 +0,0 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/plugin-args-1.rs:6:1
|
LL | #![plugin(empty_plugin)]
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default

View file

@ -1,11 +1,11 @@
error[E0498]: malformed `plugin` attribute
--> $DIR/plugin-args-2.rs:5:11
--> $DIR/plugin-args.rs:5:11
|
LL | #![plugin(empty_plugin(args))]
| ^^^^^^^^^^^^^^^^^^ malformed attribute
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/plugin-args-2.rs:5:1
--> $DIR/plugin-args.rs:5:1
|
LL | #![plugin(empty_plugin(args))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version