hygiene: Make sure expansion info is set at most once for a given Mark
This commit is contained in:
parent
17f20bec22
commit
b15785b671
@ -85,7 +85,14 @@ impl Mark {
|
||||
|
||||
#[inline]
|
||||
pub fn set_expn_info(self, info: ExpnInfo) {
|
||||
HygieneData::with(|data| data.marks[self.0 as usize].expn_info = Some(info))
|
||||
HygieneData::with(|data| {
|
||||
let old_info = &mut data.marks[self.0 as usize].expn_info;
|
||||
if let Some(old_info) = old_info {
|
||||
panic!("expansion info is reset for the mark {}\nold: {:#?}\nnew: {:#?}",
|
||||
self.0, old_info, info);
|
||||
}
|
||||
*old_info = Some(info);
|
||||
})
|
||||
}
|
||||
|
||||
pub fn modern(mut self) -> Mark {
|
||||
|
Loading…
Reference in New Issue
Block a user