Skip to content

Commit

Permalink
Merge #84
Browse files Browse the repository at this point in the history
84: Make Mapper trait object safe by adding `Self: Sized` bounds on generic functions r=phil-opp a=phil-opp

See #80 for more information

I'm not quite sure whether this is a **breaking change**, but I think it is.

Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
  • Loading branch information
bors[bot] and phil-opp authored Dec 5, 2019
2 parents ab0b21f + 897a35f commit 3038605
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/structures/paging/mapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub trait Mapper<S: PageSize> {
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError>
where
Self: Sized,
A: FrameAllocator<Size4KiB>;

/// Removes a mapping from the page table and returns the frame that used to be mapped.
Expand Down Expand Up @@ -123,6 +124,7 @@ pub trait Mapper<S: PageSize> {
frame_allocator: &mut A,
) -> Result<MapperFlush<S>, MapToError>
where
Self: Sized,
A: FrameAllocator<Size4KiB>,
S: PageSize,
Self: Mapper<S>,
Expand Down Expand Up @@ -203,3 +205,5 @@ pub enum TranslateError {
/// The page table entry for the given page points to an invalid physical address.
InvalidFrameAddress(PhysAddr),
}

static _ASSERT_OBJECT_SAFE: Option<&(dyn MapperAllSizes + Sync)> = None;

0 comments on commit 3038605

Please sign in to comment.