-
Notifications
You must be signed in to change notification settings - Fork 132
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
Comments
This was referenced Jul 8, 2019
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>
Fixed in #84 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reported in phil-opp/blog_os#639.
The
Mapper
trait is not object safe because themap_to
andidentity_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-genericmap_to_dyn
/identity_map_dyn
methods that take a&dyn mut FrameAllocator
.The text was updated successfully, but these errors were encountered: