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

force proc-macro to be no_std compatable #35

Merged
merged 1 commit into from
Oct 31, 2020
Merged

Conversation

mriise
Copy link
Contributor

@mriise mriise commented Oct 31, 2020

Setting the no_std attribute prevents std from leaking into the proc macro... for reasons I am unaware of, but it works (at least while building with thumbv6m-none-eabi as the target).

I was hoping to make an alloc feature for macro and macro-internal using the pattern I saw already being used in this library, but I couldn't get it to work.

no_std for this macro means multiformats/rust-multibase#25 can move ahead without lazy_static (and spin locks).

As a side note, proc-macro-hack isn't needed as a default as the proc-macro crate is stable.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.102% when pulling b492d58 on mriise:no_std_macro into 848efe3 on ia0:master.

@ia0 ia0 self-requested a review October 31, 2020 11:26
@ia0
Copy link
Owner

ia0 commented Oct 31, 2020

Thanks a lot for the pull-request! I wanted to look into making the macro crate no-std too but was blocked by rust-lang/cargo#7915 more or less which is now solved apparently. And I didn't put effort because I wasn't sure it was needed. So this is good to know that some projects need the macro crate to be no-std. I'll take a look at your PR tonight (Europe time) or tomorrow. Thanks again!

Copy link
Owner

@ia0 ia0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good to me. It doesn't seem to break existing use-cases and adds support for using the macro crate in no-std environments that have an allocator. I created 2 actions items for me to follow-up on this (#36 and #37).

Do you need a release for those 2 crates (macro + macro-internal)?

@ia0 ia0 merged commit a89028b into ia0:master Oct 31, 2020
@mriise mriise deleted the no_std_macro branch November 1, 2020 06:11
@mriise
Copy link
Contributor Author

mriise commented Nov 1, 2020

Take your time to make the improvements, as no_std is more of an optional feature for multibase, there is no particular rush (unless someone opens an issue otherwise).

Thank you for the quick turn around on this!

@ia0
Copy link
Owner

ia0 commented Nov 1, 2020

It turned out to be simpler than expected. I released the macro crate at version 0.1.9.

@ia0
Copy link
Owner

ia0 commented Nov 1, 2020

Note that you may need the following in your .cargo/config.toml:

[unstable]
features = ["host_dep"]

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

Successfully merging this pull request may close these issues.

None yet

3 participants