Skip to content

Commit 633e12e

Browse files
committed
Remove #[derive(Clone)] from our OOM-handling Vec<T>
If the `Vec<T>` is non-empty, then cloning will allocate, so we should only implement `TryClone`, not `Clone`.
1 parent 7051ab3 commit 633e12e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

crates/core/src/alloc/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ macro_rules! private_len {
4848

4949
/// Like `std::vec::Vec` but all methods that allocate force handling allocation
5050
/// failure.
51-
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
51+
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
5252
pub struct Vec<T> {
5353
inner: StdVec<T>,
5454
}

crates/environ/src/gc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl GcArrayLayout {
370370
/// tuples of typed fields with a certain size. The only difference in
371371
/// practice is that an exception object also carries a tag reference
372372
/// (at a fixed offset as per `GcTypeLayouts::exception_tag_offset`).
373-
#[derive(Clone, Debug)]
373+
#[derive(Debug)]
374374
pub struct GcStructLayout {
375375
/// The size (in bytes) of this struct.
376376
pub size: u32,

crates/environ/src/module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub struct TableInitialization {
237237
}
238238

239239
/// Initial value for all elements in a table.
240-
#[derive(Clone, Debug, Serialize, Deserialize)]
240+
#[derive(Debug, Serialize, Deserialize)]
241241
pub enum TableInitialValue {
242242
/// Initialize each table element to null, optionally setting some elements
243243
/// to non-null given the precomputed image.

0 commit comments

Comments
 (0)