diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-01-20 03:33:44 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-01-20 03:33:44 +0100 |
| commit | 508be3ef912572d958c8a2b995d4d1d4d1451b1d (patch) | |
| tree | 2ed0568ca6a1427aa3f0647ac4659a5561e81e6b /common/object/src | |
| parent | bc155f7abea6ee5155b6460d367a6797205db4fd (diff) | |
| download | jellything-508be3ef912572d958c8a2b995d4d1d4d1451b1d.tar jellything-508be3ef912572d958c8a2b995d4d1d4d1451b1d.tar.bz2 jellything-508be3ef912572d958c8a2b995d4d1d4d1451b1d.tar.zst | |
check tag conflicts
Diffstat (limited to 'common/object/src')
| -rw-r--r-- | common/object/src/registry.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/object/src/registry.rs b/common/object/src/registry.rs index 39ed67a..c831b28 100644 --- a/common/object/src/registry.rs +++ b/common/object/src/registry.rs @@ -5,7 +5,6 @@ */ use crate::Tag; -use log::error; use std::{any::TypeId, collections::BTreeMap}; pub mod types { @@ -25,7 +24,10 @@ pub struct Registry { impl Registry { pub fn add(&mut self, tag: Tag, info: TagInfo) { if let Some(other) = self.tags.get(&tag) { - error!("Tag conflict: {:?} vs {:?}", info.name, other.name) + panic!( + "Conflicting names for tag {}: {:?} vs {:?}", + tag.0, info.name, other.name + ) } self.tags.insert(tag, info); } @@ -49,7 +51,7 @@ pub struct TagInfo { macro_rules! fields { ($($id:ident: $type:ty = $tag:literal $name:literal;)*) => { $(pub const $id: $crate::TypedTag<$type> = $crate::TypedTag($crate::Tag($tag), std::marker::PhantomData);)* - fn register_fields(reg: &mut $crate::Registry) { + pub(crate) fn register_fields(reg: &mut $crate::Registry) { $(reg.add($crate::Tag($tag), $crate::TagInfo { name: $name, r#type: Some(std::any::TypeId::of::<$type>()) });)* } }; |