diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-08-09 08:42:41 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-08-09 08:43:11 -0400 |
| commit | ef49032297b90e7010b08db04d569dd8a5f0a8f2 (patch) | |
| tree | ef28cf8816d1d7e055454f3d74bc851c8b1d218b | |
| parent | 955aebf529787fd49b05f07346e3de97da31cb09 (diff) | |
| download | rust-ef49032297b90e7010b08db04d569dd8a5f0a8f2.tar.gz rust-ef49032297b90e7010b08db04d569dd8a5f0a8f2.zip | |
Add comment about the lack of `ExpnData` serialization for proc-macro crates
| -rw-r--r-- | src/librustc_metadata/rmeta/encoder.rs | 4 | ||||
| -rw-r--r-- | src/librustc_span/hygiene.rs | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index 352b8bff7e2..6872693a66c 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -280,6 +280,10 @@ impl<'a, 'tcx> SpecializedEncoder<Span> for EncodeContext<'a, 'tcx> { // cross-crate inconsistencies (getting one behavior in the same // crate, and a different behavior in another crate) due to the // limited surface that proc-macros can expose. + // + // IMPORTANT: If this is ever changed, be sure to update + // `rustc_span::hygiene::raw_encode_expn_id` to handle + // encoding `ExpnData` for proc-macro crates. if self.is_proc_macro { SyntaxContext::root().encode(self)?; } else { diff --git a/src/librustc_span/hygiene.rs b/src/librustc_span/hygiene.rs index 87c2c1e6bd0..74dc904b6e6 100644 --- a/src/librustc_span/hygiene.rs +++ b/src/librustc_span/hygiene.rs @@ -1188,6 +1188,9 @@ pub fn raw_encode_expn_id<E: Encoder>( let data = expn.expn_data(); // We only need to serialize the ExpnData // if it comes from this crate. + // We currently don't serialize any hygiene information data for + // proc-macro crates: see the `SpecializedEncoder<Span>` impl + // for crate metadata. if data.krate == LOCAL_CRATE { needs_data(); } |
