expand: Pass everything by reference to pre-expansion lint callback

This commit is contained in:
Vadim Petrochenkov 2021-12-11 15:32:48 +08:00
parent 05cd75504b
commit 67cccaff48
3 changed files with 46 additions and 29 deletions

View file

@ -1097,7 +1097,7 @@ impl InvocationCollectorNode for P<ast::Item> {
ModKind::Unloaded => {
// We have an outline `mod foo;` so we need to parse the file.
let old_attrs_len = attrs.len();
let ParsedExternalMod { mut items, inner_span, file_path, dir_path, dir_ownership } =
let ParsedExternalMod { items, inner_span, file_path, dir_path, dir_ownership } =
parse_external_mod(
&ecx.sess,
ident,
@ -1107,12 +1107,14 @@ impl InvocationCollectorNode for P<ast::Item> {
&mut attrs,
);
if let Some(extern_mod_loaded) = ecx.extern_mod_loaded {
(attrs, items) = extern_mod_loaded(
if let Some(lint_store) = ecx.lint_store {
lint_store.pre_expansion_lint(
ecx.sess,
ecx.resolver.registered_tools(),
ecx.current_expansion.lint_node_id,
attrs,
items,
ident.name,
&attrs,
&items,
ident.name.as_str(),
);
}