-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
ICH: Handle MacroDef HIR instances. #37787
Conversation
// Since this is hardly used anywhere, just emit a | ||
// warning for now. | ||
if self.tcx.sess.opts.debugging_opts.incremental.is_some() { | ||
let msg = format!("Quasi-quoting might make incremental \ |
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.
Shouldn't this warning be rate-limited and spanned?
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.
Yes, I could thread a span through for error reporting.
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.
Also, nit: lower-case "quasi-quoting might...."
But span seems pretty useful
5ee1acf
to
fcf85f1
Compare
Added a span to the warning. |
@michaelwoerister style nit: warnings begin with lower-case letter I think. other than, r=me |
@bors r=nikomatsakis For things like this (changing the text of a warning message), the online-editing feature is really rather convenient. |
📌 Commit 23730a9 has been approved by |
☔ The latest upstream changes (presumably #37660) made this pull request unmergeable. Please resolve the merge conflicts. |
23730a9
to
c722a1e
Compare
@bors r=nikomatsakis Rebased. |
📌 Commit c722a1e has been approved by |
ICH: Handle MacroDef HIR instances. As of recently, `hir::MacroDef` instances are exported in crate metadata, which means we also store their ICH when doing incremental compilation. Even though exported macro definitions should not (yet) interact with incremental compilation, the ICH is also used for the general purpose crate hash, where macros should be included. This PR implements ICH computation for `MacroDef`. In theory, the ICH of these MacroDefs is less stable than that of other HIR items, since I opted to just call the compiler-generated `Hash::hash()` for `Token::Interpolated` variants. `Token::Interpolated` contains AST data structures and it would have been a lot of effort to expand ICH computation to the AST too. Since quasi-quoting is rarely used *and* it would only make a difference if incremental compilation was extended to macros, the simpler implementation seemed like a good idea. This fixes the problem reported in #37756. The test still fails because of broken codegen-unit support though. r? @nikomatsakis
As of recently,
hir::MacroDef
instances are exported in crate metadata, which means we also store their ICH when doing incremental compilation. Even though exported macro definitions should not (yet) interact with incremental compilation, the ICH is also used for the general purpose crate hash, where macros should be included.This PR implements ICH computation for
MacroDef
. In theory, the ICH of these MacroDefs is less stable than that of other HIR items, since I opted to just call the compiler-generatedHash::hash()
forToken::Interpolated
variants.Token::Interpolated
contains AST data structures and it would have been a lot of effort to expand ICH computation to the AST too. Since quasi-quoting is rarely used and it would only make a difference if incremental compilation was extended to macros, the simpler implementation seemed like a good idea.This fixes the problem reported in #37756. The test still fails because of broken codegen-unit support though.
r? @nikomatsakis