Skip to content

Commit cf1ffb0

Browse files
committed
rustc_lint: Remove lint plugin_as_library
1 parent db357a6 commit cf1ffb0

File tree

7 files changed

+7
-81
lines changed

7 files changed

+7
-81
lines changed

src/doc/rustc/src/lints/listing/warn-by-default.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -307,18 +307,6 @@ warning: path statement with no effect
307307
|
308308
```
309309

310-
## plugin-as-library
311-
312-
This lint detects when compiler plugins are used as ordinary library in
313-
non-plugin crate. Some example code that triggers this lint:
314-
315-
```rust,ignore
316-
#![feature(plugin)]
317-
#![plugin(macro_crate_test)]
318-
319-
extern crate macro_crate_test;
320-
```
321-
322310
## private-in-public
323311

324312
This lint detects private items in public interfaces not caught by the old implementation. Some

src/doc/unstable-book/src/language-features/plugin.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ mechanics of defining and loading a plugin.
2424
In the vast majority of cases, a plugin should *only* be used through
2525
`#![plugin]` and not through an `extern crate` item. Linking a plugin would
2626
pull in all of libsyntax and librustc as dependencies of your crate. This is
27-
generally unwanted unless you are building another plugin. The
28-
`plugin_as_library` lint checks these guidelines.
27+
generally unwanted unless you are building another plugin.
2928

3029
The usual practice is to put compiler plugins in their own crate, separate from
3130
any `macro_rules!` macros or ordinary Rust code meant to be used by consumers

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use std::fmt::Write;
2525

2626
use rustc::hir::def::{Res, DefKind};
27-
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
27+
use rustc::hir::def_id::DefId;
2828
use rustc::ty::{self, Ty, TyCtxt, layout::VariantIdx};
2929
use rustc::{lint, util};
3030
use rustc::lint::FutureIncompatibleInfo;
@@ -800,45 +800,6 @@ impl EarlyLintPass for UnusedDocComment {
800800
}
801801
}
802802

803-
declare_lint! {
804-
PLUGIN_AS_LIBRARY,
805-
Warn,
806-
"compiler plugin used as ordinary library in non-plugin crate"
807-
}
808-
809-
declare_lint_pass!(PluginAsLibrary => [PLUGIN_AS_LIBRARY]);
810-
811-
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary {
812-
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
813-
if cx.tcx.plugin_registrar_fn(LOCAL_CRATE).is_some() {
814-
// We're compiling a plugin; it's fine to link other plugins.
815-
return;
816-
}
817-
818-
match it.kind {
819-
hir::ItemKind::ExternCrate(..) => (),
820-
_ => return,
821-
};
822-
823-
let def_id = cx.tcx.hir().local_def_id(it.hir_id);
824-
let prfn = match cx.tcx.extern_mod_stmt_cnum(def_id) {
825-
Some(cnum) => cx.tcx.plugin_registrar_fn(cnum),
826-
None => {
827-
// Probably means we aren't linking the crate for some reason.
828-
//
829-
// Not sure if / when this could happen.
830-
return;
831-
}
832-
};
833-
834-
if prfn.is_some() {
835-
cx.span_lint(PLUGIN_AS_LIBRARY,
836-
it.span,
837-
"compiler plugin used as an ordinary library");
838-
}
839-
}
840-
}
841-
842803
declare_lint! {
843804
NO_MANGLE_CONST_ITEMS,
844805
Deny,
@@ -1268,7 +1229,6 @@ declare_lint_pass!(
12681229
MISSING_DEBUG_IMPLEMENTATIONS,
12691230
ANONYMOUS_PARAMETERS,
12701231
UNUSED_DOC_COMMENTS,
1271-
PLUGIN_AS_LIBRARY,
12721232
NO_MANGLE_CONST_ITEMS,
12731233
NO_MANGLE_GENERIC_ITEMS,
12741234
MUTABLE_TRANSMUTES,

src/librustc_lint/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ macro_rules! late_lint_mod_passes {
157157
// Depends on types used in type definitions
158158
MissingCopyImplementations: MissingCopyImplementations,
159159

160-
PluginAsLibrary: PluginAsLibrary,
161-
162160
// Depends on referenced function signatures in expressions
163161
MutableTransmutes: MutableTransmutes,
164162

@@ -350,6 +348,7 @@ fn register_builtins(store: &mut lint::LintStore, no_interleave_lints: bool) {
350348
"converted into hard error, see https://github.com/rust-lang/rust/issues/35896");
351349
store.register_removed("nested_impl_trait",
352350
"converted into hard error, see https://github.com/rust-lang/rust/issues/59014");
351+
store.register_removed("plugin_as_library", "plugins have been deprecated and retired");
353352
}
354353

355354
fn register_internals(store: &mut lint::LintStore) {

src/test/ui-fulldeps/macro-crate-multi-decorator.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// run-pass
2-
3-
#![allow(plugin_as_library)]
4-
#![allow(dead_code)]
5-
#![allow(unused_variables)]
6-
#![allow(unused_imports)]
1+
// check-pass
72
// aux-build:macro-crate-test.rs
83
// ignore-stage1
94

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
// check-pass
12
// aux-build:empty-plugin.rs
23
// ignore-cross-compile
34
//
45
// empty_plugin will not compile on a cross-compiled target because
56
// libsyntax is not compiled for it.
67

7-
#![deny(plugin_as_library)]
8+
extern crate empty_plugin; // OK, plugin crates are still crates
89

9-
extern crate empty_plugin; //~ ERROR compiler plugin used as an ordinary library
10-
11-
fn main() { }
10+
fn main() {}

src/test/ui-fulldeps/plugin-as-extern-crate.stderr

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)