Skip to content

Commit 308e2ba

Browse files
committed
Implement TryClone for RegisteredType and RecGroupEntry in the types registry
1 parent f768ef3 commit 308e2ba

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

crates/wasmtime/src/runtime/type_registry.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use wasmtime_core::slab::{Id as SlabId, Slab};
2626
use wasmtime_environ::{
2727
EngineOrModuleTypeIndex, EntityRef, GcLayout, ModuleInternedTypeIndex, ModuleTypes, TypeTrace,
2828
Undo, VMSharedTypeIndex, WasmRecGroup, WasmSubType,
29-
collections::{HashSet, PrimaryMap, SecondaryMap, TryClone as _, Vec},
29+
collections::{HashSet, PrimaryMap, SecondaryMap, TryClone, Vec},
3030
iter_entity_range,
3131
packed_option::{PackedOption, ReservedValue},
3232
};
@@ -285,6 +285,12 @@ impl Clone for RegisteredType {
285285
}
286286
}
287287

288+
impl TryClone for RegisteredType {
289+
fn try_clone(&self) -> Result<Self, OutOfMemory> {
290+
Ok(self.clone())
291+
}
292+
}
293+
288294
impl Drop for RegisteredType {
289295
fn drop(&mut self) {
290296
self.engine.signatures().debug_assert_contains(self.index);
@@ -457,6 +463,12 @@ impl RegisteredType {
457463
#[derive(Clone)]
458464
struct RecGroupEntry(Arc<RecGroupEntryInner>);
459465

466+
impl TryClone for RecGroupEntry {
467+
fn try_clone(&self) -> Result<Self, OutOfMemory> {
468+
Ok(self.clone())
469+
}
470+
}
471+
460472
impl Debug for RecGroupEntry {
461473
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
462474
struct FormatAsPtr<'a, P>(&'a P);

0 commit comments

Comments
 (0)