You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specialization isn't stable in Rust yet, but we can specialize the old-fashioned way: use the mighty if.
One of the IntoHeap traits should have a static method is_trivial() which, if true, means we can move a Vec<T> into the heap without copying the buffer. It's probably OK whenever Self::In=Self, so, for machine types, tuples of trivial types, structs and enums with all trivial fields...
Then the into_heap method for Vec<T> can just ask. The branch will be inlined away.
(It's probably UB to use that trick on a Vec<FooRef<'h>> to turn it into a Vec<Pointer<Foo>>, but maybe that shouldn't stop us.)
The text was updated successfully, but these errors were encountered:
Specialization isn't stable in Rust yet, but we can specialize the old-fashioned way: use the mighty
if
.One of the
IntoHeap
traits should have a static methodis_trivial()
which, if true, means we can move aVec<T>
into the heap without copying the buffer. It's probably OK wheneverSelf::In=Self
, so, for machine types, tuples of trivial types, structs and enums with all trivial fields...Then the
into_heap
method forVec<T>
can just ask. The branch will be inlined away.(It's probably UB to use that trick on a
Vec<FooRef<'h>>
to turn it into aVec<Pointer<Foo>>
, but maybe that shouldn't stop us.)The text was updated successfully, but these errors were encountered: