Skip to content

refactor: reorganize_definitions: keep glob imports untouched - #1947

Open
ahomescu wants to merge 3 commits into
ahomescu/fix_reorganize_definitions/macro_nsfrom
ahomescu/fix_reorganize_definitions/glob_imports
Open

refactor: reorganize_definitions: keep glob imports untouched #1947
ahomescu wants to merge 3 commits into
ahomescu/fix_reorganize_definitions/macro_nsfrom
ahomescu/fix_reorganize_definitions/glob_imports

Conversation

@ahomescu

Copy link
Copy Markdown
Contributor

Fresh copy of #1927


Stack created with GitHub Stacks CLIGive Feedback 💬

@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 2451609 to 78f7f9e Compare July 25, 2026 05:09
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 78f7f9e to 938632a Compare July 25, 2026 05:33
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 938632a to 28383a8 Compare July 25, 2026 05:41
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 28383a8 to e903008 Compare July 25, 2026 05:42
@ahomescu
ahomescu changed the base branch from ahomescu/fix_reorganize_definitions/use_comments to ahomescu/fix_reorganize_definitions/widen_matched_defs July 25, 2026 05:48
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from e903008 to 1ed4d4b Compare July 25, 2026 05:48
@ahomescu
ahomescu changed the base branch from ahomescu/fix_reorganize_definitions/widen_matched_defs to ahomescu/fix_reorganize_definitions/macro_ns July 25, 2026 05:53
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 1ed4d4b to 82b8149 Compare July 25, 2026 05:53
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch 2 times, most recently from e9ab8bf to e7583f6 Compare July 25, 2026 06:05
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from e7583f6 to 338d0fe Compare July 25, 2026 06:16
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch 3 times, most recently from f74837c to 85d06d6 Compare July 25, 2026 06:51
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch 2 times, most recently from 9a8867e to 57ea173 Compare July 30, 2026 00:19
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 57ea173 to 3f83eee Compare July 30, 2026 00:31
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch 2 times, most recently from e16e815 to a4ce234 Compare July 30, 2026 22:56
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch 2 times, most recently from 3f9bb77 to eb1ca74 Compare August 4, 2026 02:41
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from eb1ca74 to 91e1573 Compare August 5, 2026 00:10
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 91e1573 to 11cb910 Compare August 5, 2026 00:19
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 11cb910 to 46ead06 Compare August 5, 2026 00:22
`Regression test: `test_reorganize_implicit_extern`
(`tests/snapshots/reorganize_implicit_extern.rs`); on pre-fix code its
implicit-`extern` declaration fails to merge with the `extern "C"` duplicate,
producing an `extern "Rust"` block and a spurious `compute_1` rename.
Regression test: `test_reorganize_glob_import`
(`tests/snapshots/reorganize_glob_import.rs`); verified to reproduce the
`UseTree::ident` panic on pre-fix code.
Glob imports are now always kept in their header module: `keep_items` adds
them to the keep set, and `insert_item` gained a dedicated `Glob` arm that
returns "not collapsed" before any `tree.ident()` call. The other listed call
sites (`Extend`, `MovedDecl::ident`) are unreachable for globs once they are
never inserted into `HeaderDeclarations`.

Nested uses are split (`:427-433`), but globs survive and hit
`UseTree::ident()`, which panics for `UseTreeKind::Glob`:

- `keep_items` at `:334`
- `insert_item` at `:1794-1798` (glob falls into the `_` arm)
- `Extend for HeaderDeclarations` at `:1690`
- `MovedDecl::ident` at `:1589`
@ahomescu
ahomescu force-pushed the ahomescu/fix_reorganize_definitions/glob_imports branch from 46ead06 to d3b0e62 Compare August 5, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant