Skip to content

Resolver: split module resolutions into local and external resolutions - #160099

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
LorrensP-2158466:split-module-resolutions
Jul 30, 2026
Merged

Resolver: split module resolutions into local and external resolutions#160099
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
LorrensP-2158466:split-module-resolutions

Conversation

@LorrensP-2158466

@LorrensP-2158466 LorrensP-2158466 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Part of #158845.

This pr splits the resolution table for local and external modules, with the external table being wrapped in a OnceLock, because only 1 thread may create that table in parallel resolution.

r? @petrochenkov

@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 Jul 28, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 28, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 28, 2026
…<try>

Resolver: split module resolutions into local and external resolutions
@rust-bors

rust-bors Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 5fd6574 (5fd657436197e7acfa920d848f00e619d7da2390)
Base parent: e19d321 (e19d321c06479c6fd77533582b0d5a86651f1be3)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5fd6574): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@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
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -0.7%)

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)
5.3% [5.3%, 5.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.7% [-5.4%, -2.0%] 2
All ❌✅ (primary) - - 0

Cycles

Results (primary -1.4%, secondary -2.1%)

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.5% [2.7%, 4.2%] 2
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-4.0% [-6.1%, -2.3%] 6
All ❌✅ (primary) -1.4% [-1.4%, -1.4%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 490.165s -> 490.132s (-0.01%)
Artifact size: 388.34 MiB -> 390.34 MiB (0.52%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 29, 2026
@LorrensP-2158466

Copy link
Copy Markdown
Contributor Author

Increased cycle count is expected due to OnceLock doing a synchronized load of its state, but its less than expected. I don't think it would benefit from having a dynamic synchronized version like Lock.

@petrochenkov

Copy link
Copy Markdown
Contributor

include-blob is irrelevant noise in this case, that benchmark doesn't even have modules, and replacing Once with OnceLock shouldn't be a regression.

Comment thread compiler/rustc_resolve/src/lib.rs Outdated
Comment thread compiler/rustc_resolve/src/lib.rs Outdated
}

type Resolutions<'ra> = CmRefCell<FxIndexMap<BindingKey, NameResolutionRef<'ra>>>;
type ResolutionTable<'ra> = CmRefCell<FxIndexMap<BindingKey, NameResolutionRef<'ra>>>;

@petrochenkov petrochenkov Jul 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The extern version of the table doesn't need CmRefCell, because it's never mutated.
But you'll have to either dismantle fn resolutions, or introduce something like CmRef to avoid it.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll try it next.

@petrochenkov

Copy link
Copy Markdown
Contributor

r=me after addressing #160099 (comment).
@rustbot author

@rustbot rustbot 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 29, 2026
@rustbot

rustbot commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

… having a `OnceLock` around it for parallel import resolution
@LorrensP-2158466
LorrensP-2158466 force-pushed the split-module-resolutions branch from 7a2d086 to 580253e Compare July 29, 2026 12:41
@LorrensP-2158466

Copy link
Copy Markdown
Contributor Author

r=me after addressing

Can't do that :D, @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 29, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 580253e has been approved by petrochenkov

It is now in the queue for this repository.

@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 29, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 29, 2026
…lutions, r=petrochenkov

Resolver: split module resolutions into local and external resolutions

Part of rust-lang#158845.

This pr splits the resolution table for local and external modules, with the external table being wrapped in a `OnceLock`, because only 1 thread may create that table in parallel resolution.

r? @petrochenkov
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 29, 2026
…lutions, r=petrochenkov

Resolver: split module resolutions into local and external resolutions

Part of rust-lang#158845.

This pr splits the resolution table for local and external modules, with the external table being wrapped in a `OnceLock`, because only 1 thread may create that table in parallel resolution.

r? @petrochenkov
rust-bors Bot pushed a commit that referenced this pull request Jul 29, 2026
Rollup of 17 pull requests

Successful merges:

 - #159014 ([rustdoc] Do not take `doc(cfg())` into account when filtering doctests)
 - #159130 (a bit optimize four-digit chunks in integer formatting)
 - #159592 (core: implement bounded random sampling)
 - #159898 (Add intrinsic-test alias and set  sample rate)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 29, 2026
…lutions, r=petrochenkov

Resolver: split module resolutions into local and external resolutions

Part of rust-lang#158845.

This pr splits the resolution table for local and external modules, with the external table being wrapped in a `OnceLock`, because only 1 thread may create that table in parallel resolution.

r? @petrochenkov
rust-bors Bot pushed a commit that referenced this pull request Jul 29, 2026
Rollup of 18 pull requests

Successful merges:

 - #159130 (a bit optimize four-digit chunks in integer formatting)
 - #159592 (core: implement bounded random sampling)
 - #159898 (Add intrinsic-test alias and set  sample rate)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160139 (iter: specialize Take::count using advance_by)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
 - #160166 (Use correct feature gates for `f16`/`f128` `From` impls)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 29, 2026
…lutions, r=petrochenkov

Resolver: split module resolutions into local and external resolutions

Part of rust-lang#158845.

This pr splits the resolution table for local and external modules, with the external table being wrapped in a `OnceLock`, because only 1 thread may create that table in parallel resolution.

r? @petrochenkov
rust-bors Bot pushed a commit that referenced this pull request Jul 29, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #159898 (Add intrinsic-test alias and set  sample rate)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #158693 (Add type-check to offload intrinisc calls)
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #159411 ([rustdoc] Correctly handle output options with --show-coverage)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160139 (iter: specialize Take::count using advance_by)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
 - #160166 (Use correct feature gates for `f16`/`f128` `From` impls)
rust-bors Bot pushed a commit that referenced this pull request Jul 30, 2026
Rollup of 20 pull requests

Successful merges:

 - #157669 (cfi: add diag mode support)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #158693 (Add type-check to offload intrinisc calls)
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #159411 ([rustdoc] Correctly handle output options with --show-coverage)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160101 (Add missing `needs-unwind` annotation to `add-spawn-hook-reentrancy-159923` test)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160139 (iter: specialize Take::count using advance_by)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
 - #160166 (Use correct feature gates for `f16`/`f128` `From` impls)
 - #160178 (Remove unused `va_start` intrinsic)
rust-bors Bot pushed a commit that referenced this pull request Jul 30, 2026
Rollup of 20 pull requests

Successful merges:

 - #157669 (cfi: add diag mode support)
 - #158247 (hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`)
 - #158649 (Hermit: fix `readdir()` )
 - #158693 (Add type-check to offload intrinisc calls)
 - #159049 (Avoid ICE in From/TryFrom cast suggestion when encountering HRTBs)
 - #159411 ([rustdoc] Correctly handle output options with --show-coverage)
 - #160053 (test: add test suite for the 85681 issue)
 - #160087 (Add regression test for nested associated-type projection ICE)
 - #160090 (rustc_resolve: Further reduce mutability in resolver)
 - #160099 (Resolver: split module resolutions into local and external resolutions)
 - #160101 (Add missing `needs-unwind` annotation to `add-spawn-hook-reentrancy-159923` test)
 - #160106 (Add suggestions for `must_implement_one_of`)
 - #160117 (Remove unnecessary format usage)
 - #160134 (Work around Wine bug 60084 by calling WSAStartup at most once)
 - #160139 (iter: specialize Take::count using advance_by)
 - #160142 (bootstrap: remove use-lld config alias)
 - #160148 (Rename `errors.rs` file to `diagnostics.rs` (15/N))
 - #160151 (Mark a doctest as requiring unwinding)
 - #160166 (Use correct feature gates for `f16`/`f128` `From` impls)
 - #160178 (Remove unused `va_start` intrinsic)
@rust-bors
rust-bors Bot merged commit 03de096 into rust-lang:main Jul 30, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 30, 2026
rust-timer added a commit that referenced this pull request Jul 30, 2026
Rollup merge of #160099 - LorrensP-2158466:split-module-resolutions, r=petrochenkov

Resolver: split module resolutions into local and external resolutions

Part of #158845.

This pr splits the resolution table for local and external modules, with the external table being wrapped in a `OnceLock`, because only 1 thread may create that table in parallel resolution.

r? @petrochenkov
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.

4 participants