Skip to content

rustc_span: Remove unused symbols. #118456

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Nov 30, 2023
Merged

Conversation

aDotInTheVoid
Copy link
Member

As noted here, there is no guarantee that all pre-interned symbols are used.

// There is currently no checking that all symbols are used; that would be
// nice to have.

This was done starting with using ripgrep to search for sym::whatever. I removed anything that didn't show up. However this had a huge number of false positives, due to extensive macro use. Then there was a manual phase of adding back all the ones used my macros.

I don't think this was worth my time to do, but it's done now . ¯_(ツ)_/¯

@rustbot
Copy link
Collaborator

rustbot commented Nov 29, 2023

r? @WaffleLapkin

(rustbot has picked a reviewer for you, use r? to override)

@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 Nov 29, 2023
@aDotInTheVoid aDotInTheVoid added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Nov 29, 2023
@aDotInTheVoid
Copy link
Member Author

As for weather this could be checked automatically in tidy, I don't think there's any easy way to do that, as it can't be answered with any text-based search.

Copy link
Member

@WaffleLapkin WaffleLapkin left a comment

Choose a reason for hiding this comment

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

r=me with green CI

(and I'm sorry for your lost time ;-;)

@aDotInTheVoid
Copy link
Member Author

@bors r=WaffleLapkin

@bors
Copy link
Collaborator

bors commented Nov 29, 2023

📌 Commit 32c035c has been approved by WaffleLapkin

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 29, 2023

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

@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 Nov 29, 2023
@aDotInTheVoid
Copy link
Member Author

@bors rollup=always

@DaniPopes
Copy link
Contributor

As for weather this could be checked automatically in tidy, I don't think there's any easy way to do that, as it can't be answered with any text-based search.

FWIW I tried this previously in #110437

Realized that I never opened a follow-up to remove just the unused symbols 😞

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 30, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#118452 (rustdoc-search: allow spaces around `::` in path query)
 - rust-lang#118453 (Tweak message on ADT with private fields building)
 - rust-lang#118456 (rustc_span: Remove unused symbols.)
 - rust-lang#118458 (rustdoc: remove small from  `small-section-header`)
 - rust-lang#118464 (Dispose llvm::TargetMachines prior to llvm::Context being disposed)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e31cd93 into rust-lang:master Nov 30, 2023
@rustbot rustbot added this to the 1.76.0 milestone Nov 30, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 30, 2023
Rollup merge of rust-lang#118456 - aDotInTheVoid:unused-symbols, r=WaffleLapkin

rustc_span: Remove unused symbols.

As noted  here, there is no guarantee that all pre-interned symbols are used.

https://github.com/rust-lang/rust/blob/b10cfcd65fd7f7b1ab9beb34798b2108de003452/compiler/rustc_span/src/symbol.rs#L124-L125

This was done starting with using ripgrep to search for `sym::whatever`. I removed anything that didn't show up. However this had a huge number of false positives, due to extensive macro use. Then there was a manual phase of adding back all the ones used my macros.

I don't think this was worth my time to do, but it's done now . ¯\_(ツ)_/¯
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. 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.

5 participants