diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-07-23 18:47:05 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-07-26 18:37:02 -0400 |
| commit | cf7bef302abb0fc7ab8bf40f22c3bc3a6aca68ff (patch) | |
| tree | b3194cd946df296223d8a29df9ce9c91c6dbc1c4 /src | |
| parent | 7e0d3fdd888b97fbb014299ede0482cf0ecf626f (diff) | |
| download | rust-cf7bef302abb0fc7ab8bf40f22c3bc3a6aca68ff.tar.gz rust-cf7bef302abb0fc7ab8bf40f22c3bc3a6aca68ff.zip | |
Properly reset `orig_id` when loading from incremental cache
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_span/hygiene.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/librustc_span/hygiene.rs b/src/librustc_span/hygiene.rs index 2bc38eab92a..44da5d77b7e 100644 --- a/src/librustc_span/hygiene.rs +++ b/src/librustc_span/hygiene.rs @@ -947,10 +947,20 @@ pub fn decode_expn_id< // Don't decode the data inside `HygieneData::with`, since we need to recursively decode // other ExpnIds - let expn_data = decode_data(d, index)?; + let mut expn_data = decode_data(d, index)?; let expn_id = HygieneData::with(|hygiene_data| { let expn_id = ExpnId(hygiene_data.expn_data.len() as u32); + + // If we just deserialized an `ExpnData` owned by + // the local crate, its `orig_id` will be stale, + // so we need to update it to its own value. + // This only happens when we deserialize the incremental cache, + // since a crate will never decode its own metadata. + if expn_data.krate == LOCAL_CRATE { + expn_data.orig_id = Some(expn_id.0); + } + hygiene_data.expn_data.push(Some(expn_data)); // Drop lock() temporary early |
