Implement Copy and Clone manually for BuddyEntry.

This fixes a warning that may in the future become an error, about the
possibility for unaligned references, since the derive macros apparently
rely on creating references to fields. Unaligned references are direct
UB.
This commit is contained in:
4lDO2
2020-12-20 16:36:52 +01:00
parent cdbeecfffe
commit 9a716604fc
+13 -1
View File
@@ -16,7 +16,6 @@ use crate::{
#[repr(transparent)]
struct BuddyUsage(u8);
#[derive(Clone, Copy)]
#[repr(packed)]
struct BuddyEntry<A> {
base: PhysicalAddress,
@@ -28,6 +27,19 @@ struct BuddyEntry<A> {
phantom: PhantomData<A>,
}
impl<A> Clone for BuddyEntry<A> {
fn clone(&self) -> Self {
Self {
base: self.base,
size: self.size,
skip: self.skip,
used: self.used,
phantom: PhantomData,
}
}
}
impl<A> Copy for BuddyEntry<A> {}
impl<A: Arch> BuddyEntry<A> {
fn empty() -> Self {
Self {