Skip to content
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

Add support for no_std environments #360

Open
YtvwlD opened this issue Oct 17, 2022 · 5 comments
Open

Add support for no_std environments #360

YtvwlD opened this issue Oct 17, 2022 · 5 comments
Labels
C-enhancement Category: Raise on the bar on expectations

Comments

@YtvwlD
Copy link

YtvwlD commented Oct 17, 2022

In the past I've written a bootloader which uses TOML as the format for the configuration file format.

The UEFI targets (i686-unknown-uefi and x86_64-unknown-uefi) provide core and alloc (among others), but they currently don't provide full std support.

toml-rs/toml-rs#391 and toml-rs/toml-rs#429 added support for those environments for the old toml-rs crate (thought they were never merged). I'd be nice to have support here.

@epage epage added the C-enhancement Category: Raise on the bar on expectations label Oct 17, 2022
@epage
Copy link
Member

epage commented Oct 17, 2022

From alex in those PRs

Thanks for the PR, but I'm personally not too thrilled to add no_std support like this. To me no_std means "only core", not "both core and alloc". This library gets pretty un-idiomatic pretty quickly (as shown here) if alloc enters the picture, and I do not want to maintain the alloc-specific code.

Thanks for the PR, but I personally do not want to maintain such support. If you have targets you're interested in building which are missing std then I'd recommend getting std to build for those targets instead.

I'm not too sure what all alex's concern was in maintaining no_std alloc support. I would prefer we wait on re-evaluating this until after #340 so we have a better idea of what the landscape will be (e.g. dependencies that need updating)

@YtvwlD
Copy link
Author

YtvwlD commented Apr 16, 2023

So, do you have a better idea of the landscape now? :)

@epage epage added M-breaking-change Meta: Implementing or merging this will introduce a breaking change. and removed M-breaking-change Meta: Implementing or merging this will introduce a breaking change. labels Apr 17, 2023
@epage
Copy link
Member

epage commented Apr 17, 2023

We likely will never support core.

Stepping through this...

  • We would likely want to copy what winnow does which simplifies some of the code.
  • I think we could add the std feature without a breaking change as std wouldn't have anything exclusive to it and the types are the same so someone should get the same behavior if they upgrade with default-features = false
  • It might be some work making sure this is all propagated from our dependencies to toml_edit to toml.
  • We might want to adopt cargo hack to help us in verifying this

My main remaining concern is any of the maintenance pain in dealing with this. With winnow, which makes a lot more sense in core/alloc use cases, its been easy to mess up and use std types on accident and not find it for a bit (granted, I've not adopted cargo hack there)

@theaddonn
Copy link

I think this is really needed

@luojia65
Copy link

luojia65 commented Jan 22, 2025

We rely on no_std TOML parsing for RustSBI and other system software, so there's a strong need for a robust no_std toml solution. @epage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

4 participants