Continuing the discussion from Setting our vision for the 2017 cycle:
I'd like to try something. There were a lot of posts that touched on topics relevant to embedded development. I'd like to get a better understanding of the feature sets that are involved here. I have this impression that embedded development is a kind of chimera: it depends very much on the particulars of your target. For example, some people are working on a Raspberry Pi running node.js, and others are in an environment where there is basically no heap and no memory allocation. Naturally the needs and constraints here will be very different.
Skimming the original roadmap thread I saw a number of related areas that I would like to understand better. I'll just drop some notes here to get things started. I'm going to include a quote or two from the original thread but by no means am I able to be comprehensive -- sorry if I miss your quote. =)
Stabilizing more of the non-std crates and APIs
Right now, the attribute #[no_std]
is stable, but just about anything you can do outside of that is not. It's true that stabilizing these low-level details has been progressing slowly. One complication is that things which seem pretty basic typically are not -- for example, we were holding off on allocate
because we thought we might want to supply metadata for tracing GC purposes. However, the latest design that @Manishearth, @pnkfelix, and I have been pursuing has abandoned that direction -- and I feel pretty confident we are not going back. It is worth doing a review of some of these APIs and trying to move forward where possible.
Support for a wider range of CPUs, toolchains
I often hear requests for making ARM support easier. This is sort of outside my wheelhouse so I'm not an expert on what is required, but I understand that there are many, many ARM families, so even this request is really a myriad of requests. Frankly, making things into a Tier 1 platform (meaning, fully tested) puts a big strain on our testing resources (we have many, many buildbots going 24x7 as it is), so I think we have to be selective here, and from what I understand many ARM architectures are already Tier 2 (meaning we distribute binaries).
Are there other ARM families we should support? Other steps needed beyond building binaries? I saw some complaints about opaque linker errors (I hear you! My eyes glaze over immediately).
Probably @alexcrichton or @brson should really be writing this paragraph, because they know what they are talking about here and I don't, but I'm the one doing it so oh well.
Handling allocation failure
Currently Rust (often?) aborts on OOM. @lilith gave a great summary of their concerns here and on issue #27700. I have heard this from others as well. My general feeling is that Rust should almost never abort but rather attempt to panic whenever possible, but there are some places that we do abort now that (e.g., double unwind, stack overflow) -- and some of them may be hard to change.
I have some questions of my own:
- Would it be sufficient if OOM panics instead of simply aborting?
- vs, say, having collection methods that return a
Result
?
- vs, say, having collection methods that return a
- How much do we worry about backwards compatibility here?
- my feeling is that all unsafe code ought to be exception safe anyhow, but having easy ways to test seems important
- certainly we can get libstd up to speed
- How important is the notion of "auditing for memory allocation"?
- I would definitely not be ready to add anything like this to the standard language or distribution -- lots of complexity and big design space here -- but I think that it is something that could be done externally with relative ease. If anyone wants to chat about this particular project in more detail, they can contact me, but here are some rough notes:
- This seems very doable today as a kind of lint, though it would probably rely on unstable compiler internals.
- This sort of analysis is often called an "effect system".
- The usual shortfalls are virtual dispatch -- e.g., calling a trait object or fn pointer -- since it's hard to know what code will run. Sometimes you may be able to use alias analysis to figure it out, but otherwise you can either be conservative, optimistic, or else start annotating traits and so forth.
- I would definitely not be ready to add anything like this to the standard language or distribution -- lots of complexity and big design space here -- but I think that it is something that could be done externally with relative ease. If anyone wants to chat about this particular project in more detail, they can contact me, but here are some rough notes:
- Does it matter if stack overflow aborts?
What'd I miss?
There are like 250 posts in the thread. I must have missed something related to embedded development.