Open yoshuawuyts opened 2 years ago
Something I forgot to add: but I believe there is a connection between platform triples and which capabilities are exposed by default. For example wasm32-unknown-unknown
will not ship with either an allocator or async runtime, but a (potential) wasm32-browser-wasi
platform could be expected to provide both.
For globals like this we may want to make them un-overridable for soundness, e.g. using the final
keyword.
cc @joshtriplett
Right now we don't have a design yet for how to model globals. We might expect
Allocator
to be a context capability, but right now that has to be set through#[global_allocator]
. It'd be great if we could model that too using context capabilities.Examples
Current
This is how to declare a global allocator today (_example using
wee-alloc
_):Proposed
What I'm wondering is whether we'd be able to replace the attribute using
with
in global position instead:This would be equivalent to doing:
Open Questions
#[global_allocator]
to this look like?