-
-
Notifications
You must be signed in to change notification settings - Fork 16.1k
rustfmt does not discover modules through cfg_select! #158371
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-rustfmtRelevant to the rustfmt team, which will review and decide on the PR/issue.Relevant to the rustfmt team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Description
Activity
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-rustfmtRelevant to the rustfmt team, which will review and decide on the PR/issue.Relevant to the rustfmt team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
In case this issue is a better fit for the rustfmt repo, feel free to move it there. Also, if this is not a good fit for the regression tag, please change it.
Given this
lib.rsand corresponding module files:When formatting this, everything is fine:
Support for detecting module files through
cfg_match!was addded in rust-lang/rustfmt#6522. Butcfg_match!was renamed tocfg_select!in #137198, and if you change the code above to saycfg_select!, it no longer detects the module files:So anyone who has used
cfg_select!to define modules in other files has possibly unformatted files. This is especially relevant due to the recent stabilization ofcfg_select!(#149783) the migration fromcfg_if!tocfg_select!in the ecosystem (e.g., rust-lang/compiler-builtins#1224).#154202 does not appear to fix this issue. Renaming the corresponding occurrences in rustfmt fixes the issue for me, so I have opened #158372.