Skip to content

Comments

Audit Symbols#152624

Open
camsteffen wants to merge 1 commit intorust-lang:mainfrom
camsteffen:symbols-audit
Open

Audit Symbols#152624
camsteffen wants to merge 1 commit intorust-lang:mainfrom
camsteffen:symbols-audit

Conversation

@camsteffen
Copy link
Contributor

@camsteffen camsteffen commented Feb 14, 2026

View all comments

Remove unused symbols and hoist some symbols to Clippy.

@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Feb 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 14, 2026

r? @adwinwhite

rustbot has assigned @adwinwhite.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 68 candidates
  • Random selection from 15 candidates

new_v1,
new_v1_formatted,
next,
niko,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

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

With the removal of the slice duplicate, you can r=me for the Clippy part.

View changes since this review

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bjorn3
Copy link
Member

bjorn3 commented Feb 14, 2026

Some of these symbols were added as a perf optimization to avoid having to allocate for identifiers that are commonly used. And pre-interned symbols are represented with less bytes in the crate metadata.

BTreeEntry,
BTreeMap,
BTreeSet,
BinaryHeap,
Copy link
Member

Choose a reason for hiding this comment

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

These were added in camsteffen@eada4d1 They are still diagnostics items.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since then, #138682 gave Clippy the ability to define their own Symbols. Many diagnostic items exist only for Clippy, so I figured only Clippy benefits from the pre-defined Symbols.

SymbolIntern,
Sync,
SyncUnsafeCell,
T,
Copy link
Member

Choose a reason for hiding this comment

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

This is a very common identifier.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather try to pre-intern all ASCII letters a-zA-Z, similarly to sym::integer, and see if it makes any difference. Many of them are common.
(Not as a part of this PR.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. I wonder if there should be a special place for pre-interned symbols that are not sym::_ consts, just to ensure that silly people like me won't spend time auditing them.

@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 14, 2026
@camsteffen
Copy link
Contributor Author

Some of these symbols were added as a perf optimization to avoid having to allocate for identifiers that are commonly used. And pre-interned symbols are represented with less bytes in the crate metadata.

Hmm, I didn't realize that. I can look for names that are common and add those back. So IIUC we may want to keep as_str since that is a common method name, but not necessarily keep String since most crates don't define a String.

I'll wait for the perf run for now.

@bjorn3
Copy link
Member

bjorn3 commented Feb 15, 2026

but not necessarily keep String since most crates don't define a String

But they do reference it. Each crate has an independent symbol interner. There is no cross-crate importing of symbols.

@adwinwhite
Copy link
Contributor

adwinwhite commented Feb 15, 2026

@bjorn3 I'm not familiar with this part and won't have much time looking into it either. Would you like to take over the review since you're already reviewing it?

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 15, 2026

☀️ Try build successful (CI)
Build commit: 6f9923e (6f9923e5e0a6b621aa74d57d64d3ff834b60a8cc, parent: a33907a7a5381473eec8bcfa0c56e05a856a911c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6f9923e): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

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.

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

Max RSS (memory usage)

Results (primary 3.0%, secondary 0.0%)

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

mean range count
Regressions ❌
(primary)
3.0% [3.0%, 3.0%] 1
Regressions ❌
(secondary)
2.3% [1.3%, 2.8%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.8% [-6.8%, -6.8%] 1
All ❌✅ (primary) 3.0% [3.0%, 3.0%] 1

Cycles

Results (secondary -3.9%)

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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-3.9%, -3.9%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.0%, secondary -0.0%)

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)
0.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 4
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 14
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 4

Bootstrap: 483.617s -> 479.802s (-0.79%)
Artifact size: 397.94 MiB -> 397.91 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 15, 2026
@rust-bors

This comment has been minimized.

@petrochenkov petrochenkov added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 18, 2026
@rustbot

This comment has been minimized.

@camsteffen
Copy link
Contributor Author

@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 Feb 18, 2026
@rust-bors

This comment has been minimized.

@petrochenkov
Copy link
Contributor

r=me after rebase.
@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 Feb 19, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 19, 2026

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

@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2026

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.

@camsteffen
Copy link
Contributor Author

@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 Feb 20, 2026
@petrochenkov
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 20, 2026

📌 Commit 0f9b166 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 Feb 20, 2026
@JonathanBrouwer
Copy link
Contributor

JonathanBrouwer commented Feb 20, 2026

@bors p=2
Scheduling this in front of the p=1 iffy job in case the rollup fails

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 20, 2026

⌛ Testing commit 0f9b166 with merge caac9cf...

Workflow: https://github.com/rust-lang/rust/actions/runs/22244490978

rust-bors bot pushed a commit that referenced this pull request Feb 20, 2026
Audit Symbols

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152624)*

Remove unused symbols and hoist some symbols to Clippy.
@jhpratt
Copy link
Member

jhpratt commented Feb 21, 2026

CI appears stuck (x86_64-gnu-aux specifically)

@bors yield

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 21, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #152624.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 21, 2026

⌛ Testing commit 0f9b166 with merge 8580dde...

Workflow: https://github.com/rust-lang/rust/actions/runs/22248970210

rust-bors bot pushed a commit that referenced this pull request Feb 21, 2026
Audit Symbols

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152624)*

Remove unused symbols and hoist some symbols to Clippy.
@jhpratt
Copy link
Member

jhpratt commented Feb 21, 2026

@bors yield

Let's give a rollup a chance first

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 21, 2026

Auto build cancelled. Cancelled workflows:

The next pull request likely to be tested is #152924.

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-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.