Comments (7)
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.
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.
Hi @koushiro
Thanks for the report!
As I see it, there are 2 problems:
- The fact that
std
may leak fromdata-encoding-macro-internal
todata-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! - 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.
@ia0 Thanks for your reply.
Is there a solution for earlier rust versions?
from data-encoding.
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.
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.
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)
- no-std support for macro crate
- Macros Won't Build in no_std HOT 4
- (std -> core)::fmt::Display for DecodeError and DecodeKind HOT 2
- Missing a new line and decode error HOT 2
- Rust 2021 edition is a major, not a "patch" change HOT 6
- Removing dependency on syn HOT 7
- Make `{encode,decode}_len` const fns? HOT 4
- Encode into an "impl std::fmt::Write" and/or "impl std::io::Write" HOT 5
- Breaking change wish list
- Use doc_auto_cfg once stable HOT 2
- Use as_chunks family of functions once stable
- Internal symbols array is publicly exposed and unsound HOT 4
- Deny warnings in rustdoc
- Partial encoding with padding HOT 3
- Question about Specification HOT 6
- Release 2.5.0
- SIMD optimization HOT 4
- `Encoding::encode_mut` is very code-size heavy HOT 15
- feature request - base58 d/encoding HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data-encoding.