Skip to content

Conversation

@petrochenkov
Copy link
Contributor

This is a re-implementation of #144131 with all the issues mentioned there fixed.

As it turned out, the non-trivial part of the split was already done in c91b6ca, so the remaining part implemented in this PR is mostly mechanical.

After addressing the issue of already found bindings being lost due to indeterminacies in outer scopes (7e890bf) and adding one missing Stage::Late in Finalize the scope splitting refactoring just worked.
(One more ICE was revealed by the refactoring, but not caused by it, fixed up in the last commit.)

This is a part of implementation for the Open API proposal.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 5, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 5, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@petrochenkov
Copy link
Contributor Author

There may be minor breakage in corner cases due to ambiguity checking being unified between in-scope resolution and in-module resolution, so this needs a crater run.
@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Dec 5, 2025
resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings
@petrochenkov petrochenkov added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2025
&& glob_binding.res() != non_glob_binding.res()
{
resolution.non_glob_binding = Some(this.new_ambiguity_binding(
AmbiguityKind::GlobVsExpanded,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yaahc you may be interested, this PR removes one of the "gray areas".

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment was marked as resolved.

@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-crater Status: Waiting on a crater run to be completed. labels Dec 6, 2025
@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Contributor Author

@bors try

rust-bors bot added a commit that referenced this pull request Dec 6, 2025
resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings
@rust-bors

This comment has been minimized.

@petrochenkov petrochenkov added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 6, 2025
@rust-bors
Copy link
Contributor

rust-bors bot commented Dec 6, 2025

☀️ Try build successful (CI)
Build commit: 0c70cfb (0c70cfbec949d241375e31c5a42066be70c720fc, parent: da2544bfbe84df7b24d83c029c74299ebf6112c6)

@petrochenkov
Copy link
Contributor Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-149681 created and queued.
🤖 Automatically detected try build 0c70cfb
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'm not incredibly familiar with name resolution, so you might want another review, but if this is mostly mechanical then it's up to you

View changes since this review

@yaahc yaahc added the A-resolve Area: Name/path resolution done by `rustc_resolve` specifically label Dec 9, 2025
@bors

This comment was marked as resolved.

@petrochenkov
Copy link
Contributor Author

Updated with a fix for crater regressions and one more cleanup.
@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 Jan 2, 2026
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me, up to you if you want another review first or another crater run

View changes since this review

@petrochenkov
Copy link
Contributor Author

petrochenkov commented Jan 4, 2026

A second crater run is certainly not needed.
@bors r=davidtwco to speedup things, there are other rustc_resolve changes depending on this.

@bors
Copy link
Collaborator

bors commented Jan 4, 2026

📌 Commit 3f3db93 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors 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 Jan 4, 2026
bors added a commit that referenced this pull request Jan 4, 2026
Rollup of 3 pull requests

Successful merges:

 - #149681 (resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings )
 - #150426 (Update offload test and verify that tgt_(un)register_lib have the right type)
 - #150678 (relate.rs: tiny cleanup: eliminate temp vars)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit df246c1 into rust-lang:main Jan 5, 2026
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Jan 5, 2026
rust-timer added a commit that referenced this pull request Jan 5, 2026
Rollup merge of #149681 - petrochenkov:openapi1, r=davidtwco

resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings

This is a re-implementation of #144131 with all the issues mentioned there fixed.

As it turned out, the non-trivial part of the split was already done in c91b6ca, so the remaining part implemented in this PR is *mostly* mechanical.

After addressing the issue of already found bindings being lost due to indeterminacies in outer scopes (7e890bf) and adding one missing `Stage::Late` in `Finalize` the scope splitting refactoring just worked.
(One more ICE was revealed by the refactoring, but not caused by it, fixed up in the last commit.)

This is a part of implementation for the [Open API](https://rust-lang.github.io/rust-project-goals/2025h1/open-namespaces.html) proposal.
@Kobzol
Copy link
Member

Kobzol commented Jan 5, 2026

@rust-timer build 1782736

Testing perf for #150682.

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1782736): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.1%, 1.5%] 157
Regressions ❌
(secondary)
0.7% [0.0%, 3.4%] 86
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 4
All ❌✅ (primary) 0.5% [0.1%, 1.5%] 157

Max RSS (memory usage)

Results (primary 2.5%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
6.9% [6.9%, 6.9%] 1
Regressions ❌
(secondary)
1.6% [1.2%, 2.5%] 4
Improvements ✅
(primary)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
-2.8% [-3.1%, -2.6%] 2
All ❌✅ (primary) 2.5% [-1.9%, 6.9%] 2

Cycles

Results (secondary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.8% [1.2%, 8.7%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.2% [-4.6%, -3.8%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 475.648s -> 477.159s (0.32%)
Artifact size: 390.89 MiB -> 390.83 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Jan 5, 2026
@Kobzol
Copy link
Member

Kobzol commented Jan 5, 2026

The regressions are mostly only in incremental check builds, but they are still not completely trivial. Any ideas about what could be done to get rid of them?

@petrochenkov
Copy link
Contributor Author

There are no fundamental reasons for this to be a perf regression, all the necessary regression parts were supposed to already be merged in #149454.
I'll look what's going on.

@petrochenkov
Copy link
Contributor Author

There are no fundamental reasons for this to be a perf regression, all the necessary regression parts were supposed to already be merged in #149454. I'll look what's going on.

The speedup attempts can be found in #150741.

@Kobzol
Copy link
Member

Kobzol commented Jan 7, 2026

Awesome, thank you!

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-resolve Area: Name/path resolution done by `rustc_resolve` specifically perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

9 participants