diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index e5441f13870e3..933361d812cb0 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2378,10 +2378,12 @@ impl ops::DerefMut for Vec { } } +#[cfg(not(no_global_oom_handling))] trait SpecCloneFrom { fn clone_from(this: &mut Self, other: &Self); } +#[cfg(not(no_global_oom_handling))] impl SpecCloneFrom for Vec { default fn clone_from(this: &mut Self, other: &Self) { // drop anything that will not be overwritten @@ -2397,6 +2399,7 @@ impl SpecCloneFrom for Vec { } } +#[cfg(not(no_global_oom_handling))] impl SpecCloneFrom for Vec { fn clone_from(this: &mut Self, other: &Self) { this.clear();