Giter VIP home page Giter VIP logo

Comments (7)

ia0 avatar ia0 commented on July 20, 2024 1

I'll look into this this week-end because it'll take some time. I want to do some experiments to see if there is a regression or if this is more of a feature request.

from data-encoding.

ia0 avatar ia0 commented on July 20, 2024 1

I've published data-encoding-macro=0.1.12 (and data-encoding-macro-internal=0.1.10) which should fix your issue. Thanks again for reporting the regression!

from data-encoding.

ia0 avatar ia0 commented on July 20, 2024

Hi @koushiro

Thanks for the report!

As I see it, there are 2 problems:

  1. The fact that std may leak from data-encoding-macro-internal to data-encoding-macro. The recommended solution for that is to use the new resolver as described in the README. I actually forgot to publish it when I updated it. It's done now. Thanks for bringing that up!
  2. The data-encoding crate is built multiple times when using macros in no-std environments. I don't think this is fixable. There is one build with std for proc-macro and one build without. Note that there are only 2 builds when using alloc (and not 3). This is due to feature unification where the macro lib will use the alloc build instead of asking for a no-alloc build.

Does this clarify the situation?

from data-encoding.

koushiro avatar koushiro commented on July 20, 2024

@ia0 Thanks for your reply.

Is there a solution for earlier rust versions?

from data-encoding.

ia0 avatar ia0 commented on July 20, 2024

Yes, it's in the README too. I don't know the earliest version where it would work, but it's at least a year (tracking issue).

from data-encoding.

koushiro avatar koushiro commented on July 20, 2024

But it's doesn't work for earlier stable rust version, target thumbv6m-none-eabi.

you could try to run the below command under data-encoding/lib/macro directory:

cargo build --no-default-features --target thumbv6m-none-eabi

the target thumbv6m-none-eabi don't support libstd (only support liballoc and libcore), it's a good environment for no_std checking.

from data-encoding.

ia0 avatar ia0 commented on July 20, 2024

I could take a deeper look. I finally agree with your original post. Let me restate it with my own words:

  • After a89028b and before 76e21dd, it was possible to use the macro library with the alloc feature with stable compilers.
  • After 76e21dd, this was accidentally reverted in some refactoring.
  • This doesn't matter for compilers 1.51 and later, but it does for compilers 1.50 and earlier.
  • This can be fixed by using alloc feature in the macro internal proc-macro crate.
  • This means that for old stable compilers, only the alloc and std features can be used (currently only std is possible because of the bug). For newer compilers (stable and nightly) using the new resolver, the no-alloc feature can also be used.

However, note that it's still not clear to me how a project may use the alloc feature with a stable compiler. I have problems with #[alloc_error_handler].

from data-encoding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.