Skip to content

Commit

Permalink
Add missing cfg attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
a1phyr committed Aug 12, 2021
1 parent 3613980 commit 94d6b22
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2378,10 +2378,12 @@ impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
}
}

#[cfg(not(no_global_oom_handling))]
trait SpecCloneFrom {
fn clone_from(this: &mut Self, other: &Self);
}

#[cfg(not(no_global_oom_handling))]
impl<T: Clone, A: Allocator> SpecCloneFrom for Vec<T, A> {
default fn clone_from(this: &mut Self, other: &Self) {
// drop anything that will not be overwritten
Expand All @@ -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> {
fn clone_from(this: &mut Self, other: &Self) {
this.clear();
Expand Down

0 comments on commit 94d6b22

Please sign in to comment.