-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Serialize all foreign SourceFile
s into proc-macro crate metadata
#73706
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I think this code doesn't need to be changed, but I'm not 100% certain: rust/src/librustc_middle/hir/map/collector.rs Lines 171 to 182 in d8ed1b0
When we encode a proc-macro crate, we'll end up serializing some foreign |
I'm also not sure, but the logic seems reasonable. |
Something like this is definitely preferable to #69976 as and end state. r=me with the nit addressed |
5115132
to
3c1743c
Compare
I've removed the call to @bors r=petrochenkov |
📌 Commit 3c1743cb40da105a120133fb3d041c66b8e092e7 has been approved by |
This comment has been minimized.
This comment has been minimized.
3c1743c
to
2765149
Compare
@bors r=petrochenkov |
📌 Commit 2765149 has been approved by |
…an, r=petrochenkov Serialize all foreign `SourceFile`s into proc-macro crate metadata Normally, we encode a `Span` that references a foreign `SourceFile` by encoding information about the foreign crate. When we decode this `Span`, we lookup the foreign crate in order to decode the `SourceFile`. However, this approach does not work for proc-macro crates. When we load a proc-macro crate, we do not deserialzie any of its dependencies (since a proc-macro crate can only export proc-macros). This means that we cannot serialize a reference to an upstream crate, since the associated metadata will not be available when we try to deserialize it. This commit modifies foreign span handling so that we treat all foreign `SourceFile`s as local `SourceFile`s when serializing a proc-macro. All `SourceFile`s will be stored into the metadata of a proc-macro crate, allowing us to cotinue to deserialize a proc-macro crate without needing to load any of its dependencies. Since the number of foreign `SourceFile`s that we load during a compilation session may be very large, we only serialize a `SourceFile` if we have also serialized a `Span` which requires it.
@bors r- failed the rollup, likely
|
@bors r+ rollup=never It looks like one of the other PRs in the rollup affected a symbol ID in src/test/ui/proc-macro/meta-macro-hygiene.rs |
📌 Commit 2765149 has been approved by |
@bors r=petrochenkov |
📌 Commit 5e0396555fc0b3721c90a97e030800714c7d3d51 has been approved by |
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 |
5e03965
to
37a48fa
Compare
Forgot to bless a stderr file @bors r=petrochenkov |
📌 Commit 37a48fa has been approved by |
⌛ Testing commit 37a48fa with merge 83c62c0537052bce30041002fc57bc73c98b96cf... |
@bors r- yield retry sorry, just made a rollup |
@bors r=petrochenkov retry |
📌 Commit 37a48fa has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Normally, we encode a
Span
that references a foreignSourceFile
byencoding information about the foreign crate. When we decode this
Span
, we lookup the foreign crate in order to decode theSourceFile
.However, this approach does not work for proc-macro crates. When we load
a proc-macro crate, we do not deserialzie any of its dependencies (since
a proc-macro crate can only export proc-macros). This means that we
cannot serialize a reference to an upstream crate, since the associated
metadata will not be available when we try to deserialize it.
This commit modifies foreign span handling so that we treat all foreign
SourceFile
s as localSourceFile
s when serializing a proc-macro.All
SourceFile
s will be stored into the metadata of a proc-macrocrate, allowing us to cotinue to deserialize a proc-macro crate without
needing to load any of its dependencies.
Since the number of foreign
SourceFile
s that we load during acompilation session may be very large, we only serialize a
SourceFile
if we have also serialized a
Span
which requires it.