Skip to content

Use interned symbols instead of strings in more places #14855

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2025

Conversation

samueltardieu
Copy link
Contributor

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented May 20, 2025

r? @y21

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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 20, 2025
@samueltardieu samueltardieu force-pushed the more-symbols branch 2 times, most recently from 408b066 to d961cf4 Compare May 25, 2025 10:02
@samueltardieu
Copy link
Contributor Author

Rebased

Copy link
Member

@y21 y21 left a comment

Choose a reason for hiding this comment

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

Generally looks good, just one question

Comment on lines 13 to 18
complete_path: String,
parent: &[Symbol],
complete_path: impl FnOnce(&str) -> String,
) {
match attr_paths.entry(complete_path) {
let parent = parent.iter().join(":");
match attr_paths.entry(complete_path(&parent)) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for this closure-based change? The join + closure call (which invokes format!()) looks like it's doing essentially the same thing as before which had the format!() directly inlined as the function argument, or am I missing a subtle difference? (The change from Vec<String> to Vec<Symbol> is nice though)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, reading the other comment from Alexendoo, I guess the variable declaration line above used to be way longer and you wanted to share that between the two calls? It's not really much longer anymore now and the closure makes it slightly harder to tell what's going on but that's a bit pedantic, if you still think that's an improvement then I'm fine merging it as is too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, it is best to leave it quasi-untouched, as to focus on the meaning of this PR only. Only a .iter() needs to be added, I've pushed the change.

@y21 y21 added this pull request to the merge queue Jun 1, 2025
Merged via the queue into rust-lang:master with commit 3f48a2b Jun 1, 2025
11 checks passed
@samueltardieu samueltardieu deleted the more-symbols branch June 2, 2025 10:54
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants