Skip to content

Commit

Permalink
Make Mapper trait object safe by adding Self: Sized bounds on gener…
Browse files Browse the repository at this point in the history
…ic functions
  • Loading branch information
phil-opp committed Dec 10, 2019
1 parent 037d9b8 commit ae11c57
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 ae11c57

Please sign in to comment.