runmat_hir/ids.rs
1use serde::{Deserialize, Serialize};
2
3macro_rules! id_newtype {
4 ($name:ident) => {
5 /// Local identity inside one HIR assembly.
6 ///
7 /// These IDs are stable only while referring to the same compiler product.
8 /// Persisted or cross-session identity should use qualified semantic paths such
9 /// as `DefPath`, not these arena-style numeric IDs.
10 #[derive(
11 Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
12 )]
13 pub struct $name(pub usize);
14 };
15}
16
17id_newtype!(ModuleId);
18id_newtype!(FunctionId);
19id_newtype!(ClassId);
20id_newtype!(EntrypointId);
21id_newtype!(BindingId);
22id_newtype!(ExprId);
23id_newtype!(StmtId);
24id_newtype!(SourceId);