diff --git a/misc/codegen/generators/rustgen.py b/misc/codegen/generators/rustgen.py index b47e5cc4bd9d..38d2ae55d44b 100644 --- a/misc/codegen/generators/rustgen.py +++ b/misc/codegen/generators/rustgen.py @@ -96,7 +96,9 @@ def _get_class(self, name: str) -> rust.Class: name=name, fields=fields, detached_fields=detached_fields, - ancestors=sorted(set(a.name for a in _get_ancestors(cls, self._classmap))), + # remove duplicates but preserve ordering + # (`dict` preserves insertion order while `set` doesn't) + ancestors=[*{a.name: None for a in _get_ancestors(cls, self._classmap)}], entry_table=inflection.tableize(cls.name) if not cls.derived else None, ) diff --git a/rust/extractor/src/generated/.generated.list b/rust/extractor/src/generated/.generated.list index 8f599f1cc391..f4582cf85f43 100644 --- a/rust/extractor/src/generated/.generated.list +++ b/rust/extractor/src/generated/.generated.list @@ -1,2 +1,2 @@ mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 -top.rs 36b202b412b08876b658a14a15f5b7e6ce3d2d9388bba9cd6fe75265855adfe6 36b202b412b08876b658a14a15f5b7e6ce3d2d9388bba9cd6fe75265855adfe6 +top.rs 22ca74a6a44e2984afdaffbc536d847296a79312d201b81948a32fe56064c8bf 22ca74a6a44e2984afdaffbc536d847296a79312d201b81948a32fe56064c8bf diff --git a/rust/extractor/src/generated/top.rs b/rust/extractor/src/generated/top.rs index 822ddf0c122b..4386de180168 100644 --- a/rust/extractor/src/generated/top.rs +++ b/rust/extractor/src/generated/top.rs @@ -131,18 +131,18 @@ impl trap::TrapClass for AstNode { fn class_name() -> &'static str { "AstNode" } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AstNode is a subclass of Element + // SAFETY: this is safe because in the dbscheme AstNode is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AstNode is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AstNode is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -188,18 +188,18 @@ impl trap::TrapClass for Crate { fn class_name() -> &'static str { "Crate" } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Crate is a subclass of Element + // SAFETY: this is safe because in the dbscheme Crate is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Crate is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme Crate is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -225,18 +225,18 @@ impl trap::TrapClass for Missing { fn class_name() -> &'static str { "Missing" } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Missing is a subclass of Element + // SAFETY: this is safe because in the dbscheme Missing is a subclass of Unextracted unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Missing is a subclass of Unextracted + // SAFETY: this is safe because in the dbscheme Missing is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -262,18 +262,18 @@ impl trap::TrapClass for Unimplemented { fn class_name() -> &'static str { "Unimplemented" } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Unimplemented is a subclass of Element + // SAFETY: this is safe because in the dbscheme Unimplemented is a subclass of Unextracted unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Unimplemented is a subclass of Unextracted + // SAFETY: this is safe because in the dbscheme Unimplemented is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -312,18 +312,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Abi is a subclass of Element + // SAFETY: this is safe because in the dbscheme Abi is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Abi is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme Abi is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -357,18 +357,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Addressable is a subclass of Element + // SAFETY: this is safe because in the dbscheme Addressable is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Addressable is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme Addressable is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -407,18 +407,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ArgList is a subclass of Element + // SAFETY: this is safe because in the dbscheme ArgList is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ArgList is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme ArgList is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -453,18 +453,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmDirSpec is a subclass of Element + // SAFETY: this is safe because in the dbscheme AsmDirSpec is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmDirSpec is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AsmDirSpec is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -489,18 +489,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmOperand is a subclass of Element + // SAFETY: this is safe because in the dbscheme AsmOperand is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmOperand is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AsmOperand is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -543,18 +543,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmOperandExpr is a subclass of Element + // SAFETY: this is safe because in the dbscheme AsmOperandExpr is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmOperandExpr is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AsmOperandExpr is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -593,18 +593,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmOption is a subclass of Element + // SAFETY: this is safe because in the dbscheme AsmOption is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmOption is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AsmOption is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -629,18 +629,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmPiece is a subclass of Element + // SAFETY: this is safe because in the dbscheme AsmPiece is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmPiece is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AsmPiece is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -679,18 +679,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmRegSpec is a subclass of Element + // SAFETY: this is safe because in the dbscheme AsmRegSpec is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AsmRegSpec is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AsmRegSpec is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -715,18 +715,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AssocItem is a subclass of Element + // SAFETY: this is safe because in the dbscheme AssocItem is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AssocItem is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AssocItem is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -769,18 +769,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AssocItemList is a subclass of Element + // SAFETY: this is safe because in the dbscheme AssocItemList is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme AssocItemList is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme AssocItemList is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -819,18 +819,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Attr is a subclass of Element + // SAFETY: this is safe because in the dbscheme Attr is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Attr is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme Attr is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -855,18 +855,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Callable is a subclass of Element + // SAFETY: this is safe because in the dbscheme Callable is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Callable is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme Callable is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -905,18 +905,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ClosureBinder is a subclass of Element + // SAFETY: this is safe because in the dbscheme ClosureBinder is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ClosureBinder is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme ClosureBinder is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -941,18 +941,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Expr is a subclass of Element + // SAFETY: this is safe because in the dbscheme Expr is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme Expr is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme Expr is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -977,18 +977,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ExternItem is a subclass of Element + // SAFETY: this is safe because in the dbscheme ExternItem is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ExternItem is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme ExternItem is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1031,18 +1031,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ExternItemList is a subclass of Element + // SAFETY: this is safe because in the dbscheme ExternItemList is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ExternItemList is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme ExternItemList is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1067,18 +1067,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme FieldList is a subclass of Element + // SAFETY: this is safe because in the dbscheme FieldList is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme FieldList is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme FieldList is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1121,18 +1121,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme FormatArgsArg is a subclass of Element + // SAFETY: this is safe because in the dbscheme FormatArgsArg is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme FormatArgsArg is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme FormatArgsArg is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1157,18 +1157,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericArg is a subclass of Element + // SAFETY: this is safe because in the dbscheme GenericArg is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericArg is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme GenericArg is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1207,18 +1207,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericArgList is a subclass of Element + // SAFETY: this is safe because in the dbscheme GenericArgList is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericArgList is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme GenericArgList is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1243,18 +1243,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericParam is a subclass of Element + // SAFETY: this is safe because in the dbscheme GenericParam is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericParam is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme GenericParam is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1293,18 +1293,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericParamList is a subclass of Element + // SAFETY: this is safe because in the dbscheme GenericParamList is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme GenericParamList is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme GenericParamList is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1347,18 +1347,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ItemList is a subclass of Element + // SAFETY: this is safe because in the dbscheme ItemList is a subclass of Locatable unsafe { Self::from_untyped(value.as_untyped()) } } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label) -> Self { - // SAFETY: this is safe because in the dbscheme ItemList is a subclass of Locatable + // SAFETY: this is safe because in the dbscheme ItemList is a subclass of Element unsafe { Self::from_untyped(value.as_untyped()) } @@ -1397,18 +1397,18 @@ impl From> for trap::Label { } } -impl From> for trap::Label { +impl From> for trap::Label { fn from(value: trap::Label