Rollup merge of #115081 - Zoxc:expn-id-decode, r=cjgillot

Allow overwriting ExpnId for concurrent decoding

These assertions only hold for the single threaded compiler. They were triggered in https://github.com/rust-lang/rust/pull/115003.
This commit is contained in:
Matthias Krüger 2023-08-25 09:00:12 +02:00 committed by GitHub
commit 49cdf06b4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1291,11 +1291,11 @@ pub fn register_expn_id(
let expn_id = ExpnId { krate, local_id };
HygieneData::with(|hygiene_data| {
let _old_data = hygiene_data.foreign_expn_data.insert(expn_id, data);
debug_assert!(_old_data.is_none());
debug_assert!(_old_data.is_none() || cfg!(parallel_compiler));
let _old_hash = hygiene_data.foreign_expn_hashes.insert(expn_id, hash);
debug_assert!(_old_hash.is_none());
debug_assert!(_old_hash.is_none() || _old_hash == Some(hash));
let _old_id = hygiene_data.expn_hash_to_expn_id.insert(hash, expn_id);
debug_assert!(_old_id.is_none());
debug_assert!(_old_id.is_none() || _old_id == Some(expn_id));
});
expn_id
}