File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -947,10 +947,20 @@ pub fn decode_expn_id<
947947
948948 // Don't decode the data inside `HygieneData::with`, since we need to recursively decode
949949 // other ExpnIds
950- let expn_data = decode_data ( d, index) ?;
950+ let mut expn_data = decode_data ( d, index) ?;
951951
952952 let expn_id = HygieneData :: with ( |hygiene_data| {
953953 let expn_id = ExpnId ( hygiene_data. expn_data . len ( ) as u32 ) ;
954+
955+ // If we just deserialized an `ExpnData` owned by
956+ // the local crate, its `orig_id` will be stale,
957+ // so we need to update it to its own value.
958+ // This only happens when we deserialize the incremental cache,
959+ // since a crate will never decode its own metadata.
960+ if expn_data. krate == LOCAL_CRATE {
961+ expn_data. orig_id = Some ( expn_id. 0 ) ;
962+ }
963+
954964 hygiene_data. expn_data . push ( Some ( expn_data) ) ;
955965
956966 // Drop lock() temporary early
You can’t perform that action at this time.
0 commit comments