Skip to content

Commit ef49032

Browse files
committed
Add comment about the lack of ExpnData serialization for proc-macro crates
1 parent 955aebf commit ef49032

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/librustc_metadata/rmeta/encoder.rs

+4
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ impl<'a, 'tcx> SpecializedEncoder<Span> for EncodeContext<'a, 'tcx> {
280280
// cross-crate inconsistencies (getting one behavior in the same
281281
// crate, and a different behavior in another crate) due to the
282282
// limited surface that proc-macros can expose.
283+
//
284+
// IMPORTANT: If this is ever changed, be sure to update
285+
// `rustc_span::hygiene::raw_encode_expn_id` to handle
286+
// encoding `ExpnData` for proc-macro crates.
283287
if self.is_proc_macro {
284288
SyntaxContext::root().encode(self)?;
285289
} else {

src/librustc_span/hygiene.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,9 @@ pub fn raw_encode_expn_id<E: Encoder>(
11881188
let data = expn.expn_data();
11891189
// We only need to serialize the ExpnData
11901190
// if it comes from this crate.
1191+
// We currently don't serialize any hygiene information data for
1192+
// proc-macro crates: see the `SpecializedEncoder<Span>` impl
1193+
// for crate metadata.
11911194
if data.krate == LOCAL_CRATE {
11921195
needs_data();
11931196
}

0 commit comments

Comments
 (0)