-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Use tcx.symbol_name when determining clashing extern declarations. #80009
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
Use tcx.symbol_name when determining clashing extern declarations. #80009
Conversation
@@ -2595,7 +2596,7 @@ declare_lint! { | |||
} | |||
|
|||
pub struct ClashingExternDeclarations { | |||
seen_decls: FxHashMap<Symbol, HirId>, | |||
seen_decls: FxHashMap<String, HirId>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory this could just store &'tcx str
without an issue, but the impl_lint_pass!
macro does not support lints parametric over a lifetime T_T.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could just store &'tcx str without an issue
Yeah, you're right -- that would let me avoid the allocation completely.
the impl_lint_pass! macro does not support lints parametric over a lifetime T_T
I don't think I'll address this in this PR -- I've just added a FIXME note for now, until impl_lint_pass!
can take lifetimes.
Seems reasonable to me! |
a154be7
to
fa02a8e
Compare
This should be good for re-review once green. |
@bors: r+ Thanks! |
📌 Commit fa02a8ed6405d6cd2e4f5bd27cde9f0c2f59184b has been approved by |
⌛ Testing commit fa02a8ed6405d6cd2e4f5bd27cde9f0c2f59184b with merge a0f9320b9d4490efe6beace771710a58f1a3e44c... |
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
fa02a8e
to
4b740ac
Compare
Not sure why it failed the first time. @alexcrichton -- can you re-approve? |
@bors: retry |
Ah, @bors r=alexcrichton - the prior approval wouldn't have worked I expect since commits have been pushed since then. |
📌 Commit 4b740ac has been approved by |
☀️ Test successful - checks-actions |
@jumbatm @nagisa This was the cause of a minor perf regression. I wonder how much of it is the allocation of the symbol name string vs the call |
Thanks for the heads-up. I'll have a look into this. |
…nagisa clashing_extern_declarations: Use symbol interning to avoid string alloc. Use symbol interning as a hack to avoid allocating a string for every symbol name we store in the seen set. This hopefully addresses the minor perf regression described in rust-lang#80009 (comment). r? `@nagisa`
Fixes #79581.
r? @alexcrichton