Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Mapper trait object safe by adding Self: Sized bounds on generic functions #84

Merged
merged 2 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
- **Breaking:** Replace `ux` dependency with custom wrapper structs ([#91](https://github.com/rust-osdev/x86_64/pull/91))
- **Breaking:** Add new UnsafePhysFrame type and use it in Mapper::map_to ([#89](https://github.com/rust-osdev/x86_64/pull/89))
- _Possibly Breaking:_ Make Mapper trait object safe by adding `Self: Sized` bounds on generic functions ([#84](https://github.com/rust-osdev/x86_64/pull/84))


# 0.7.7

Expand Down
4 changes: 4 additions & 0 deletions src/structures/paging/mapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,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 @@ -118,6 +119,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 @@ -198,3 +200,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;