Skip to content

Move lang item collection to the resolver - #163525

Open
oli-obk wants to merge 1 commit into
rust-lang:mainfrom
oli-obk:resolver_lang_items
Open

oli-obk wants to merge 1 commit into
rust-lang:mainfrom
oli-obk:resolver_lang_items

Conversation

@oli-obk

@oli-obk oli-obk commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

The separate query had to walk the entire ast again, also tracking owners and converting NodeIds to DefIds. I think it's nicer to just do it as part of the resolver.

Alternatively we could limit the lang item collection to the local ones and keep the query. Instead of walking the current crate again we'd just take the list from the resolver query just like we take the list from upstream crates.

@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 Sep 30, 2026
@oli-obk

oli-obk commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

@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 Sep 30, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 30, 2026
Move lang item collection to the resolver
@rust-bors

rust-bors Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: ee7b1cf (ee7b1cf2bee32b699e66c83d9f1a5707b555c962)
Base parent: c1bf6e1 (c1bf6e13fa5ff2c753a49fd5ef37371c6fed729f)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ee7b1cf): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

@bors rollup=never rustc-perf
@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
Improvements ✅
(primary)
-0.2% [-0.6%, -0.1%] 67
Improvements ✅
(secondary)
-0.3% [-0.8%, -0.1%] 30
All ❌✅ (primary) -0.2% [-0.6%, -0.1%] 67

Max RSS (memory usage)

Results (secondary 1.3%)

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)
2.7% [1.4%, 5.9%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.7% [-5.7%, -5.7%] 1
All ❌✅ (primary) - - 0

Cycles

Results (primary 1.5%, secondary -0.3%)

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

mean range count
Regressions ❌
(primary)
1.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
4.0% [4.0%, 4.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.8%, -2.1%] 2
All ❌✅ (primary) 1.5% [1.5%, 1.5%] 1

Binary size

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

Bootstrap: 489.184s -> 489.805s (0.13%)
Artifact size: 406.44 MiB -> 406.38 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 30, 2026
@oli-obk

oli-obk commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

r? @petrochenkov

@oli-obk
oli-obk marked this pull request as ready for review September 30, 2026 14:13
@rustbot

rustbot commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@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 Sep 30, 2026
Comment thread compiler/rustc_resolve/src/late/weak_lang_items.rs
Comment thread compiler/rustc_resolve/src/late/lang_items.rs Outdated
Comment thread compiler/rustc_resolve/src/late/lang_items.rs Outdated
@petrochenkov

petrochenkov commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Alternatively we could limit the lang item collection to the local ones and keep the query. Instead of walking the current crate again we'd just take the list from the resolver query just like we take the list from upstream crates.

It probably doesn't matter much where exactly the set of extern crates is walked, in rustc_resolve or later in rustc_passes (from a query)?
The full list of lang items is going to be queried anyway, unless something rare happens, like an early enough fatal error.

@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 Oct 13, 2026
@rust-bors

This comment has been minimized.

@oli-obk
oli-obk force-pushed the resolver_lang_items branch from 90ed939 to 18b002a Compare October 23, 2026 16:31
@rustbot

rustbot commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@oli-obk

oli-obk commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

addressed the review comments

@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 Oct 23, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tidy check
x.py completions check
tidy [rustdoc_json (src)]: `rustdoc-json-types` modified, checking format version
tidy: Skipping binary file check, read-only filesystem
tidy [style (compiler)]: /checkout/compiler/rustc_passes/src/lang_items.rs: leading newline
tidy [style (compiler)]: /checkout/compiler/rustc_passes/src/lang_items.rs: too many trailing newlines (2)
tidy [style (compiler)]: FAIL
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.12' and 'venv'
Requirement already satisfied: pip in ./build/venv/lib/python3.12/site-packages (24.0)
Collecting pip
  Downloading pip-26.2.2-py3-none-any.whl.metadata (4.6 kB)
---
Running eslint on rustdoc JS files
info: ES-Check: checking 7 files...
info: ✓ ES-Check passed! All files are ES10 compatible.
typechecking javascript files
tidy: The following check failed: style (compiler)
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/checkout --cargo-path=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/checkout/obj/build --concurrency=4 --npm-path=/node/bin/yarn --ci=true --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1627:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1828:24

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Currently active steps:
test::Tidy {  } at src/bootstrap/src/core/build_steps/test.rs:1743
Build completed unsuccessfully in 0:02:36
  local time: Fri Oct 23 16:43:11 UTC 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants