summaryrefslogtreecommitdiff
path: root/rust/src/types.rs
diff options
context:
space:
mode:
authorRubens Brandao <git@rubens.io>2024-04-10 17:58:05 -0300
committerRubens Brandao <git@rubens.io>2024-04-10 18:02:09 -0300
commit37b51462dcf26dc40ac5d7e82acdfd4cbe754157 (patch)
tree6a6bb04329059518761f6b5be5506d32a6b6c47c /rust/src/types.rs
parent16fc31044f3b202200a6f03a538cda5f985bbecb (diff)
fix the array implementation using GAT
Diffstat (limited to 'rust/src/types.rs')
-rw-r--r--rust/src/types.rs38
1 files changed, 20 insertions, 18 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs
index 2a2a50d4..43d48b3f 100644
--- a/rust/src/types.rs
+++ b/rust/src/types.rs
@@ -1453,10 +1453,10 @@ unsafe impl CoreOwnedArrayProvider for NamedTypedVariable {
}
}
-unsafe impl<'a> CoreArrayWrapper<'a> for NamedTypedVariable {
- type Wrapped = ManuallyDrop<NamedTypedVariable>;
+unsafe impl CoreArrayWrapper for NamedTypedVariable {
+ type Wrapped<'a> = ManuallyDrop<NamedTypedVariable>;
- unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped {
+ unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
ManuallyDrop::new(NamedTypedVariable {
var: raw.var,
ty: raw.type_,
@@ -2348,10 +2348,10 @@ unsafe impl CoreOwnedArrayProvider for QualifiedName {
}
}
-unsafe impl<'a> CoreArrayWrapper<'a> for QualifiedName {
- type Wrapped = &'a QualifiedName;
+unsafe impl CoreArrayWrapper for QualifiedName {
+ type Wrapped<'a> = &'a QualifiedName;
- unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped {
+ unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
mem::transmute(raw)
}
}
@@ -2390,10 +2390,10 @@ unsafe impl CoreOwnedArrayProvider for QualifiedNameAndType {
}
}
-unsafe impl<'a> CoreArrayWrapper<'a> for QualifiedNameAndType {
- type Wrapped = &'a QualifiedNameAndType;
+unsafe impl CoreArrayWrapper for QualifiedNameAndType {
+ type Wrapped<'a> = &'a QualifiedNameAndType;
- unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped {
+ unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
mem::transmute(raw)
}
}
@@ -2436,10 +2436,10 @@ unsafe impl CoreOwnedArrayProvider for QualifiedNameTypeAndId {
}
}
-unsafe impl<'a> CoreArrayWrapper<'a> for QualifiedNameTypeAndId {
- type Wrapped = &'a QualifiedNameTypeAndId;
+unsafe impl CoreArrayWrapper for QualifiedNameTypeAndId {
+ type Wrapped<'a> = &'a QualifiedNameTypeAndId;
- unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped {
+ unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
mem::transmute(raw)
}
}
@@ -2497,10 +2497,11 @@ unsafe impl<S: BnStrCompatible> CoreOwnedArrayProvider for NameAndType<S> {
}
}
-unsafe impl<'a, S: 'a + BnStrCompatible> CoreArrayWrapper<'a> for NameAndType<S> {
- type Wrapped = &'a NameAndType<S>;
+unsafe impl<S: BnStrCompatible> CoreArrayWrapper for NameAndType<S> {
+ type Wrapped<'a> = &'a NameAndType<S> where S: 'a;
- unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped {
+ unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
+ // TODO this is not always valid, because the type is not transparent
mem::transmute(raw)
}
}
@@ -2544,10 +2545,11 @@ unsafe impl CoreOwnedArrayProvider for DataVariable {
}
}
-unsafe impl<'a> CoreArrayWrapper<'a> for DataVariable {
- type Wrapped = &'a DataVariable;
+unsafe impl CoreArrayWrapper for DataVariable {
+ type Wrapped<'a> = &'a DataVariable;
- unsafe fn wrap_raw(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped {
+ unsafe fn wrap_raw<'a>(raw: &'a Self::Raw, _context: &'a Self::Context) -> Self::Wrapped<'a> {
+ // TODO this is not always valid, because the type is not transparent
mem::transmute(raw)
}
}