Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Support for an alloc feature? #322

Open
cbeck88 opened this issue Sep 12, 2019 · 1 comment
Open

Support for an alloc feature? #322

cbeck88 opened this issue Sep 12, 2019 · 1 comment

Comments

@cbeck88
Copy link

cbeck88 commented Sep 12, 2019

I'm trying to port prost so that it can work in an alloc-only environment. Specifically we want to use it inside of an SGX enclave.

prost-derive is a proc-macro crate, that uses failure crate to do error handling. Unfortunately for us, it turns out that prost-derive uses failure::Error and failure::Bail, which require the feature failure/std. But because of long-standing issues in cargo, this means that failure crate will globally be std, and so our no_std, alloc-only targets won't build that are using failure crate.

There's a separate issue in cargo project so that deps of build.rs and proc-macro don't infect the rest of the build but it's a long way away as I understand.

Are you interested in a patch that adds an alloc feature to failure crate and makes more of failure crate, specifically the macros, work in alloc mode?

I'm trying to decide if the best way forward for our project is to patch prost-derive away from using failure crate, or to try to make these parts of failure crate more portable.

@cbeck88
Copy link
Author

cbeck88 commented Sep 12, 2019

As a temporary workaround, I have republished this crate as alt-failure on cargo, so that I can make prost-derive depend on it instead of failure crate in my project, but renaming it to failure in prost-derive Cargo.toml so that no code changes in prost-derive are needed for this issue. Then the proc-macro is free to use std without causing std to infect the main target. Would love a better solution

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant