Rename LocalInternedString and more#65776
Conversation
|
I mentioned elsewhere my suggestion of |
There was a problem hiding this comment.
We can probably replace most string literals with valid literals in them, in the compiler, with sym::s.
I'd try this if I was in front of my laptop:
rg '"[_a-zA-Z][_a-zA-Z0-9]*"' src/lib*There was a problem hiding this comment.
rust_eh_personality already is a symbol. We could add the other two. For all potential static symbols there is a decision about whether the identifier is hot enough or frequently used enough for it to be worthwhile, and that decision is not always clear-cut.
"Intern all the static strings" is a possibility, but it would add a lot more due to functions like this one:
rust/src/librustdoc/clean/cfg.rs
Lines 337 to 402 in 10a52c2
There was a problem hiding this comment.
(I should add: I have already converted all the static identifiers that I though were worth converting. Other people may reasonably think that more should be converted.)
src/libsyntax_pos/symbol.rs
Outdated
There was a problem hiding this comment.
cc @Manishearth could elsa have a FrozenIndexSet that is also thread-safe without a lock?
In this case, just a Sync FrozenVec might be enough.
|
Can I please not be the reviewer? =D It appears @estebank is. :) |
|
Indeed, I mixed up GitHub's "assignees" and "reviewers" fields. @estebank is the reviewer. |
|
@bors r+ rollup=never |
|
📌 Commit 7a466f070585c2f399b3980e1fe6b7e0c721c989 has been approved by |
|
☔ The latest upstream changes (presumably #65718) made this pull request unmergeable. Please resolve the merge conflicts. |
It makes the relationship with `Symbol` clearer. The `Str` suffix matches the existing `Symbol::as_str()` method nicely, and is also consistent with it being a wrapper of `&str`.
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch of unnecessary sigils.
Because it's highly magical, which goes against the goal of keeping `SymbolStr` simple. Plus it's only used in a handful of places that only require minor changes.
7a466f0 to
d0db290
Compare
|
I rebased. @bors r=estebank |
|
📌 Commit d0db290 has been approved by |
|
⌛ Testing commit d0db290 with merge 0afc234c654c32d457d73f5c454b89455918dfaa... |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
💔 Test failed - checks-azure |
|
No Tools Breakage Week is over, or close enough that by the time this gets through the queue it will be. @bors r=estebank |
|
💡 This pull request was already approved, no need to approve it again.
|
|
📌 Commit d0db290 has been approved by |
…ing-and-more, r=estebank Rename `LocalInternedString` and more This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses. r? @estebank
Rollup of 9 pull requests Successful merges: - #65776 (Rename `LocalInternedString` and more) - #65973 (caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!.) - #66015 (librustc_lexer: Refactor the module) - #66062 (Configure LLVM module PIC level) - #66086 (bump smallvec to 1.0) - #66092 (Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD.) - #66103 (Add target thumbv7neon-unknown-linux-musleabihf) - #66133 (Update the bundled `wasi-libc` repository) - #66139 (use American spelling for `pluralize!`) Failed merges: r? @ghost
|
@bors rollup=maybe |
rustup rust-lang/rust#65776 changelog: none
AFAICT these changes are required based on the changes `LocalInternedString` and `SymbolStr` in rust-lang/rust#65776
This PR renames
LocalInternedStringasSymbolStr, removes an unnecessaryimplfrom it, improves comments, and cleans up someSymbolStruses.r? @estebank