Skip to content

resolver: don't use Finalize when resolving visibilities during AST expansion#158689

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
LorrensP-2158466:non-final-vis-resolve
Jul 5, 2026
Merged

resolver: don't use Finalize when resolving visibilities during AST expansion#158689
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
LorrensP-2158466:non-final-vis-resolve

Conversation

@LorrensP-2158466

Copy link
Copy Markdown
Contributor

During AST expansion we need to resolve visibilities of items. It uses Finalize to make sure to get a definite result on the resolution (a sort of hacky way). this pr disables the use of Finalize as it contradicts the invariant proposed by it:

/// Invariant: if `Finalize` is used, expansion and import resolution must be complete.
struct Finalize { ... }

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 2, 2026
@LorrensP-2158466

Copy link
Copy Markdown
Contributor Author

lets see what CI says.

@petrochenkov petrochenkov self-assigned this Jul 2, 2026
@LorrensP-2158466 LorrensP-2158466 marked this pull request as ready for review July 2, 2026 14:26
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 2, 2026
@LorrensP-2158466

Copy link
Copy Markdown
Contributor Author

This should probably have a crater check run, right?

@petrochenkov

Copy link
Copy Markdown
Contributor

Could you add the "finalize implies !has_unexpanded_invocations" asserts that we discussed in the previous PR (to both globs and non-globs)?

@petrochenkov

Copy link
Copy Markdown
Contributor

This should probably have a crater check run, right?

Beta run should be enough, if this didn't break anything in the test suite, then I'm 99% sure it won't break anything in practice.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 2, 2026
@LorrensP-2158466 LorrensP-2158466 force-pushed the non-final-vis-resolve branch from 33ab4d7 to 4c3aa1f Compare July 3, 2026 10:04
@LorrensP-2158466

Copy link
Copy Markdown
Contributor Author

force-pushed to amend commits. @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 3, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 4c3aa1f has been approved by petrochenkov

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 3, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 3, 2026
…olve, r=petrochenkov

resolver: don't use `Finalize` when resolving visibilities during AST expansion

During AST expansion we need to resolve visibilities of items. It uses `Finalize` to make sure to get a definite result on the resolution (a sort of hacky way). this pr disables the use of `Finalize` as it contradicts the invariant proposed by it:
```rust
/// Invariant: if `Finalize` is used, expansion and import resolution must be complete.
struct Finalize { ... }
```
rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
Rollup of 18 pull requests

Successful merges:

 - #158692 (Add release notes for 1.96.1)
 - #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
 - #152860 (Port the `without_debuginfo` test from `backtrace-rs` to the testsuite)
 - #155932 (MIR Call terminator: evaluate destination place before arguments)
 - #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
 - #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
 - #157835 (expand free alias types in the auto-trait orphan check)
 - #158377 (add `-Zforce-intrinsic-fallback` flag)
 - #158434 (delegation: refactor AST -> HIR lowering)
 - #158552 (make some tidy errors around python easier to understand)
 - #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
 - #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
 - #158711 (library: Comment on libtest's dicey internal soundness)
 - #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
 - #158659 (refactor the normalization in `coerce_shared_info`)
 - #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
 - #158698 (Update TypeVisitable implementation)
 - #158706 (Tweaks to MIR building scope API)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 5, 2026
…olve, r=petrochenkov

resolver: don't use `Finalize` when resolving visibilities during AST expansion

During AST expansion we need to resolve visibilities of items. It uses `Finalize` to make sure to get a definite result on the resolution (a sort of hacky way). this pr disables the use of `Finalize` as it contradicts the invariant proposed by it:
```rust
/// Invariant: if `Finalize` is used, expansion and import resolution must be complete.
struct Finalize { ... }
```
rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #158692 (Add release notes for 1.96.1)
 - #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
 - #155932 (MIR Call terminator: evaluate destination place before arguments)
 - #155989 (Update `transmute_copy` to ub_checks and `?Sized`)
 - #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
 - #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
 - #157835 (expand free alias types in the auto-trait orphan check)
 - #157857 (Stabilize `#[my_macro] mod foo;` (part of `proc_macro_hygiene`))
 - #158377 (add `-Zforce-intrinsic-fallback` flag)
 - #158434 (delegation: refactor AST -> HIR lowering)
 - #158552 (make some tidy errors around python easier to understand)
 - #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
 - #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
 - #158711 (library: Comment on libtest's dicey internal soundness)
 - #158751 (rustdoc: Fix crash when trying to inline foreign item which cannot have attributes)
 - #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
 - #158659 (refactor the normalization in `coerce_shared_info`)
 - #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
 - #158698 (Update TypeVisitable implementation)
 - #158706 (Tweaks to MIR building scope API)
rust-bors Bot pushed a commit that referenced this pull request Jul 5, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #158692 (Add release notes for 1.96.1)
 - #134021 (Implement `IntoIterator` for `[&[mut]] Box<[T; N], A>`)
 - #155932 (MIR Call terminator: evaluate destination place before arguments)
 - #155989 (Update `transmute_copy` to ub_checks and `?Sized`)
 - #156777 (Add -Zautodiff_post_passes flag to limit which llvm passes to run after enzyme to make autodiff tests more robust)
 - #157151 (JSON target specs: remove 'x86-softfloat' compatibility alias)
 - #157835 (expand free alias types in the auto-trait orphan check)
 - #157857 (Stabilize `#[my_macro] mod foo;` (part of `proc_macro_hygiene`))
 - #158434 (delegation: refactor AST -> HIR lowering)
 - #158552 (make some tidy errors around python easier to understand)
 - #158624 (borrowck: Introduce BlameConstraint::to_obligation_cause_from_path())
 - #158704 (Optimize `ArrayChunks::try_rfold` with `DoubleEndedIterator::next_chunk_back`)
 - #158711 (library: Comment on libtest's dicey internal soundness)
 - #158751 (rustdoc: Fix crash when trying to inline foreign item which cannot have attributes)
 - #158539 (Move `SizeHint` and `IoHandle` to `core::io`)
 - #158659 (refactor the normalization in `coerce_shared_info`)
 - #158689 (resolver: don't use `Finalize` when resolving visibilities during AST expansion)
 - #158698 (Update TypeVisitable implementation)
 - #158706 (Tweaks to MIR building scope API)
@rust-bors rust-bors Bot merged commit c0c6b6d into rust-lang:main Jul 5, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants