Skip to content

Commit a501308

Browse files
committed
Replace #[plugin_registrar] with exporting __rustc_plugin_registrar
1 parent 2d10c2a commit a501308

35 files changed

+287
-556
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
375375
}
376376

377377
ast::ItemKind::Fn(..) => {
378-
if self.sess.contains_name(&i.attrs[..], sym::plugin_registrar) {
379-
gate_feature_post!(
380-
&self,
381-
plugin_registrar,
382-
i.span,
383-
"compiler plugins are experimental and possibly buggy"
384-
);
385-
}
386378
if self.sess.contains_name(&i.attrs[..], sym::start) {
387379
gate_feature_post!(
388380
&self,

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
137137
reachable_non_generics.insert(id.to_def_id(), SymbolExportLevel::C);
138138
}
139139

140-
if let Some(id) = tcx.plugin_registrar_fn(()) {
141-
reachable_non_generics.insert(id.to_def_id(), SymbolExportLevel::C);
142-
}
143-
144140
reachable_non_generics
145141
}
146142

compiler/rustc_feature/src/active.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,6 @@ declare_features! (
281281
// feature-group-start: actual feature gates
282282
// -------------------------------------------------------------------------
283283

284-
/// Allows using `#[plugin_registrar]` on functions.
285-
(active, plugin_registrar, "1.0.0", Some(29597), None),
286-
287284
/// Allows using `#![plugin(myplugin)]`.
288285
(active, plugin, "1.0.0", Some(29597), None),
289286

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -291,18 +291,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
291291
),
292292

293293
// Plugins:
294-
(
295-
sym::plugin_registrar, Normal, template!(Word),
296-
Gated(
297-
Stability::Deprecated(
298-
"https://github.com/rust-lang/rust/pull/64675",
299-
Some("may be removed in a future compiler version"),
300-
),
301-
sym::plugin_registrar,
302-
"compiler plugins are deprecated",
303-
cfg_fn!(plugin_registrar)
304-
)
305-
),
306294
(
307295
sym::plugin, CrateLevel, template!(List: "name"),
308296
Gated(

compiler/rustc_feature/src/removed.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ declare_features! (
136136
(removed, main, "1.53.0", Some(29634), None, None),
137137
(removed, pub_macro_rules, "1.53.0", Some(78855), None,
138138
Some("removed due to being incomplete, in particular it does not work across crates")),
139-
/// Allows the definition of `const` functions with some advanced features.
139+
/// Allows the definition of `const` functions with some advanced features.
140140
(removed, const_fn, "1.54.0", Some(57563), None,
141141
Some("split into finer-grained feature gates")),
142+
/// Allows using `#[plugin_registrar]` on functions.
143+
(removed, plugin_registrar, "1.54.0", Some(29597), None,
144+
Some("a __rustc_plugin_registrar symbol must now be defined instead")),
142145

143146
/// Allows `#[doc(include = "some-file")]`.
144147
(removed, external_doc, "1.54.0", Some(44732), None,

compiler/rustc_interface/src/passes.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,6 @@ pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
741741
let providers = &mut Providers::default();
742742
providers.analysis = analysis;
743743
proc_macro_decls::provide(providers);
744-
plugin::build::provide(providers);
745744
rustc_middle::hir::provide(providers);
746745
mir::provide(providers);
747746
mir_build::provide(providers);
@@ -856,8 +855,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
856855
{
857856
entry_point = sess.time("looking_for_entry_point", || tcx.entry_fn(()));
858857

859-
sess.time("looking_for_plugin_registrar", || tcx.ensure().plugin_registrar_fn(()));
860-
861858
sess.time("looking_for_derive_registrar", || {
862859
tcx.ensure().proc_macro_decls_static(())
863860
});

compiler/rustc_metadata/src/locator.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ use rustc_session::config::{self, CrateType};
226226
use rustc_session::filesearch::{FileDoesntMatch, FileMatches, FileSearch};
227227
use rustc_session::search_paths::PathKind;
228228
use rustc_session::utils::CanonicalizedPath;
229-
use rustc_session::{Session, StableCrateId};
229+
use rustc_session::Session;
230230
use rustc_span::symbol::{sym, Symbol};
231231
use rustc_span::Span;
232232
use rustc_target::spec::{Target, TargetTriple};
@@ -787,7 +787,7 @@ pub fn find_plugin_registrar(
787787
metadata_loader: &dyn MetadataLoader,
788788
span: Span,
789789
name: Symbol,
790-
) -> (PathBuf, StableCrateId) {
790+
) -> PathBuf {
791791
match find_plugin_registrar_impl(sess, metadata_loader, name) {
792792
Ok(res) => res,
793793
// `core` is always available if we got as far as loading plugins.
@@ -799,7 +799,7 @@ fn find_plugin_registrar_impl<'a>(
799799
sess: &'a Session,
800800
metadata_loader: &dyn MetadataLoader,
801801
name: Symbol,
802-
) -> Result<(PathBuf, StableCrateId), CrateError> {
802+
) -> Result<PathBuf, CrateError> {
803803
info!("find plugin registrar `{}`", name);
804804
let mut locator = CrateLocator::new(
805805
sess,
@@ -816,7 +816,7 @@ fn find_plugin_registrar_impl<'a>(
816816

817817
match locator.maybe_load_library_crate()? {
818818
Some(library) => match library.source.dylib {
819-
Some(dylib) => Ok((dylib.0, library.metadata.get_root().stable_crate_id())),
819+
Some(dylib) => Ok(dylib.0),
820820
None => Err(CrateError::NonDylibPlugin(name)),
821821
},
822822
None => Err(locator.into_error()),

compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,9 +1252,6 @@ rustc_queries! {
12521252
query entry_fn(_: ()) -> Option<(DefId, EntryFnType)> {
12531253
desc { "looking up the entry function of a crate" }
12541254
}
1255-
query plugin_registrar_fn(_: ()) -> Option<LocalDefId> {
1256-
desc { "looking up the plugin registrar for a crate" }
1257-
}
12581255
query proc_macro_decls_static(_: ()) -> Option<LocalDefId> {
12591256
desc { "looking up the derive registrar for a crate" }
12601257
}

compiler/rustc_plugin_impl/src/build.rs

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

compiler/rustc_plugin_impl/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use rustc_lint::LintStore;
1414

15-
pub mod build;
1615
pub mod load;
1716

1817
/// Structure used to register plugins.

0 commit comments

Comments
 (0)