Apply suggestions from code review

Co-authored-by: Paolo Tranquilli <redsun82@github.com>
This commit is contained in:
Arthur Baars
2025-06-20 13:20:35 +02:00
parent b7f66f8653
commit 2acce96bb5

View File

@@ -41,15 +41,20 @@ macro_rules! pre_emit {
};
($($_:tt)*) => {};
}
// TODO: remove the mannually written Label conversions. These can be auto-generated by
// changing the base class of AssocItem from AstNode to Item
impl From<crate::trap::Label<generated::AssocItem>> for crate::trap::Label<generated::Item> {
fn from(value: crate::trap::Label<generated::AssocItem>) -> Self {
// SAFETY: this is safe because in the dbscheme Item is a subclass of Stmt
// SAFETY: this is safe because every concrete instance of `@assoc_item` is also an instance of `@item`
unsafe { Self::from_untyped(value.as_untyped()) }
}
}
// TODO: remove the mannually written Label conversions. These can be auto-generated by
// changing the base class of ExternItem from AstNode to Item
impl From<crate::trap::Label<generated::ExternItem>> for crate::trap::Label<generated::Item> {
fn from(value: crate::trap::Label<generated::ExternItem>) -> Self {
// SAFETY: this is safe because in the dbscheme Item is a subclass of Stmt
// SAFETY: this is safe because every concrete instance of `@extern_item` is also an instance of `@item`
unsafe { Self::from_untyped(value.as_untyped()) }
}
}