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 are then expanded normally during the main expansion pass, like attributes on any other nodes.
This commit is contained in:
parent
f26da39e04
commit
aca1b1e0b3
12 changed files with 108 additions and 84 deletions
|
@ -112,8 +112,8 @@ fn fast_print_path(path: &ast::Path) -> Symbol {
|
|||
|
||||
pub(crate) fn registered_tools(tcx: TyCtxt<'_>, (): ()) -> RegisteredTools {
|
||||
let mut registered_tools = RegisteredTools::default();
|
||||
let krate = tcx.crate_for_resolver(()).borrow();
|
||||
for attr in attr::filter_by_name(&krate.attrs, sym::register_tool) {
|
||||
let (_, pre_configured_attrs) = &*tcx.crate_for_resolver(()).borrow();
|
||||
for attr in attr::filter_by_name(pre_configured_attrs, sym::register_tool) {
|
||||
for nested_meta in attr.meta_item_list().unwrap_or_default() {
|
||||
match nested_meta.ident() {
|
||||
Some(ident) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue