luaur_analysis/records/
unifiable.rs1#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4pub struct Error<Id> {
5 pub index: i32,
6 pub synthetic: Option<Id>,
8}
9
10impl<Id: Copy> Error<Id> {
11 pub fn new() -> Self {
12 static NEXT_INDEX: core::sync::atomic::AtomicI32 = core::sync::atomic::AtomicI32::new(0);
13 Self {
14 index: NEXT_INDEX.fetch_add(1, core::sync::atomic::Ordering::Relaxed),
15 synthetic: None,
16 }
17 }
18
19 pub fn with_synthetic(synthetic: Id) -> Self {
20 static NEXT_INDEX: core::sync::atomic::AtomicI32 = core::sync::atomic::AtomicI32::new(0);
21 Self {
22 index: NEXT_INDEX.fetch_add(1, core::sync::atomic::Ordering::Relaxed),
23 synthetic: Some(synthetic),
24 }
25 }
26}