Repository navigation
Conversation
For programs that build the interpreter from the tables themselves (Interpreter::new) and are built with a stable compiler, such as a UEFI boot manager reading the battery. The allocator API, which needs nightly, is only used by the `platform` module and `Interpreter::new_from_platform`. They are now behind a `platform` feature, on by default; `default-features = false, features = ["aml"]` builds with a stable compiler. CI builds that configuration, so it keeps working.
|
Nice idea, thanks @ogoffart. I have also wondered about using a stable compiler, but didn't realise it'd be so straightforward 😆 One question: does the "alloc" feature actually do anything now? Is it worth just removing it? |
With the platform module behind its own feature, `alloc` only enabled `extern crate alloc`, which only the aml and platform features need: it did nothing on its own. The crate now uses alloc when either is on. CI's i686 build without the interpreter uses `platform` instead.
|
yes that's true, the alloc feature itself don't make sense. I've removed it. |
martin-hughes
left a comment
There was a problem hiding this comment.
Looks very sensible to me. I think this is an area where I'd like to get @IsaacWoods to double-check, since he knows the background of why the features were designed how they were - any thoughts Isaac?
|
Thanks for the PR @ogoffart and for your recent contributions! I personally develop against the nightly compiler routinely, and find working around things awaiting stabilisation quite irritating. Without digging into rationale (and with a huge amount of respect to the complicated work on the Rust compiler by contributors), I don't understand why So the question becomes - if we reworked the use of This may seem pedantic; I just want to lay out my thinking about what the features should represent.
@martin-hughes thoughts? |
|
My motivation here is only to be able to use this crate with a stable compiler for my utility (a UEFI boot loader that queries the battery status) |
|
Thanks both - my thoughts.
I agree. I tend to use Stable when I can. Sometimes working around things waiting to be stabilised is annoying, but equally it's annoying if things get removed from Nightly 😆 (e.g. kwzhao/x2apic-rs#32). Stable would also increase the crate's potential reach. On balance, I'm happy with the principle of "if it's easy enough". Question though: is there a chance of needing nightly again in future? That would be a breaking change. Personally, I think the chance is fairly low - we've pushed back on adding allocator API to
I think this is a reasonable plan - I support it. To be fully "stable" we'd also need to remove the None of this seems blocking.
Yes, agree - I use the platform module and quite like it.
Fair comment. I had half an eye on this so I don't mind tweaking it later. TL;DR: Good thoughts @IsaacWoods. Does what I've written help? What should we do for this PR? Assuming you think switching to stable is a good move, is it fair to say you'd like this PR to do all of that by:
|
For programs that build the interpreter from the tables themselves (Interpreter::new) and are built with a stable compiler, such as a UEFI boot manager reading the battery.
The allocator API, which needs nightly, is only used by the
platformmodule andInterpreter::new_from_platform. They are now behind aplatformfeature, on by default;default-features = false, features = ["aml"]builds with a stable compiler. CI builds that configuration, so it keeps working.This would allow me to use this crate with a stable compiler.