Skip to content

fix: extract_module missing import for macro calls#22437

Open
Albab-Hasan wants to merge 1 commit into
rust-lang:masterfrom
Albab-Hasan:extract-module-macro-import
Open

fix: extract_module missing import for macro calls#22437
Albab-Hasan wants to merge 1 commit into
rust-lang:masterfrom
Albab-Hasan:extract-module-macro-import

Conversation

@Albab-Hasan
Copy link
Copy Markdown
Contributor

check_def_in_mod_and_out_sel had arms for every item kind (Function, Adt, Const, etc.) but no arm for Definition::Macro. it fell through to _ => {} and returned (false, false), making def_out_sel always false for macros. in downstream the condition (def_out_sel || !is_item) && use_stmt_not_in_sel was never satisfied so no import was added to the extracted module.

add Definition::Macro(x) => check_item!(x), to the match so the macros source location is checked the same way as other items.

closes #20209

  Fixes rust-lang#20209

   was missing a  arm,
  causing it to always return  for macros. This made
   false, so the import was never added to the extracted
  module.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract module assist fails to add import for function-like macro

2 participants