1
Fork 0

Add missing cfg attribute

This commit is contained in:
Benoît du Garreau 2021-08-12 10:48:04 +02:00
parent 361398009b
commit 94d6b22fc3

View file

@ -2378,10 +2378,12 @@ impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
} }
} }
#[cfg(not(no_global_oom_handling))]
trait SpecCloneFrom { trait SpecCloneFrom {
fn clone_from(this: &mut Self, other: &Self); fn clone_from(this: &mut Self, other: &Self);
} }
#[cfg(not(no_global_oom_handling))]
impl<T: Clone, A: Allocator> SpecCloneFrom for Vec<T, A> { impl<T: Clone, A: Allocator> SpecCloneFrom for Vec<T, A> {
default fn clone_from(this: &mut Self, other: &Self) { default fn clone_from(this: &mut Self, other: &Self) {
// drop anything that will not be overwritten // drop anything that will not be overwritten
@ -2397,6 +2399,7 @@ impl<T: Clone, A: Allocator> SpecCloneFrom for Vec<T, A> {
} }
} }
#[cfg(not(no_global_oom_handling))]
impl<T: Copy, A: Allocator> SpecCloneFrom for Vec<T, A> { impl<T: Copy, A: Allocator> SpecCloneFrom for Vec<T, A> {
fn clone_from(this: &mut Self, other: &Self) { fn clone_from(this: &mut Self, other: &Self) {
this.clear(); this.clear();