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

Mapper trait is not object safe #80

Closed
phil-opp opened this issue Jul 8, 2019 · 1 comment
Closed

Mapper trait is not object safe #80

phil-opp opened this issue Jul 8, 2019 · 1 comment

Comments

@phil-opp
Copy link
Member

phil-opp commented Jul 8, 2019

Reported in phil-opp/blog_os#639.

The Mapper trait is not object safe because the map_to and identity_map methods are generic (prevents object safety since they can't be monomorphized).

To fix this, we could add Self: Sized bounds to the two methods, but I think this would make the methods not callable on a &dyn Mapper object. So maybe we should additionally add non-generic map_to_dyn/identity_map_dyn methods that take a &dyn mut FrameAllocator.

bors bot added a commit that referenced this issue Dec 5, 2019
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.

89: Add new UnsafePhysFrame type and use it in Mapper::map_to r=phil-opp a=phil-opp

Fixes #88 

This pull request adds a new `UnsafePhysFrame` type that wraps a `PhysFrame`. The type is unsafe to construct and the caller must guarantee that the frame is not mapped already. This type allows to make the `map_to` and `identity_map` methods of the `Mapper` trait safe. This PR also adjust the `FrameAllocator` to use the new type.

This is a **breaking change**.



Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
bors bot added a commit that referenced this issue Dec 5, 2019
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.

89: Add new UnsafePhysFrame type and use it in Mapper::map_to r=phil-opp a=phil-opp

Fixes #88 

This pull request adds a new `UnsafePhysFrame` type that wraps a `PhysFrame`. The type is unsafe to construct and the caller must guarantee that the frame is not mapped already. This type allows to make the `map_to` and `identity_map` methods of the `Mapper` trait safe. This PR also adjust the `FrameAllocator` to use the new type.

This is a **breaking change**.



Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
bors bot added a commit that referenced this issue Dec 5, 2019
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>
@phil-opp
Copy link
Member Author

Fixed in #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant