diff options
| author | bors <bors@rust-lang.org> | 2023-03-23 15:17:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-23 15:17:59 +0000 |
| commit | df7fd9995f10627f25ccb325f693a11b3395a73c (patch) | |
| tree | abad82c242e3e04ccfb721ea6c689283b621b8b2 /compiler/rustc_plugin_impl/src | |
| parent | 99c49d95cd7d704d2226859cfdc419c930cde9c6 (diff) | |
| parent | aca1b1e0b3820ae03622c37fb1b32e005d737fbf (diff) | |
| download | rust-df7fd9995f10627f25ccb325f693a11b3395a73c.tar.gz rust-df7fd9995f10627f25ccb325f693a11b3395a73c.zip | |
Auto merge of #108221 - petrochenkov:cratecfg, r=michaelwoerister
rustc_interface: Add a new query `pre_configure` It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes. This is a continuation of https://github.com/rust-lang/rust/pull/92473 and one more step to very unstable crate-level proc macro attributes maybe actually working. Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
Diffstat (limited to 'compiler/rustc_plugin_impl/src')
| -rw-r--r-- | compiler/rustc_plugin_impl/src/load.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_plugin_impl/src/load.rs b/compiler/rustc_plugin_impl/src/load.rs index 8e75e969ae0..27e5cb9f0d0 100644 --- a/compiler/rustc_plugin_impl/src/load.rs +++ b/compiler/rustc_plugin_impl/src/load.rs @@ -3,7 +3,7 @@ use crate::errors::{LoadPluginError, MalformedPluginAttribute}; use crate::Registry; use libloading::Library; -use rustc_ast::Crate; +use rustc_ast::Attribute; use rustc_metadata::locator; use rustc_session::cstore::MetadataLoader; use rustc_session::Session; @@ -20,11 +20,11 @@ type PluginRegistrarFn = fn(&mut Registry<'_>); pub fn load_plugins( sess: &Session, metadata_loader: &dyn MetadataLoader, - krate: &Crate, + attrs: &[Attribute], ) -> Vec<PluginRegistrarFn> { let mut plugins = Vec::new(); - for attr in &krate.attrs { + for attr in attrs { if !attr.has_name(sym::plugin) { continue; } |
