Open
Description
The methods of AddressSpace
take &dyn DataSource
, e.g.:
cs393_vm_api/src/address_space.rs
Lines 43 to 50 in 2d1299b
But the struct itself stores Arc<dyn DataSource>
:
cs393_vm_api/src/address_space.rs
Line 9 in 2d1299b
My instinct is that add_mapping
should just take an Arc
. The broader issue is that the methods of DataSource
only have shared access to self
, and there's no way to safely upcast &self
to Arc<self>
. So as I see it, either:
- The
DataSource
methods to have a stronger reference to self. MapType
needs to store&dyn DataSource
(maybe fine! TheDataSource
API is immutable anyway).- There's some clever invariant that will make it ok to unsafely mutate
&dyn DataSource
intoArc<dyn DataSource>
. This seems pretty unlikely to me.
Metadata
Metadata
Assignees
Labels
No labels