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

Feature gate allocator_api #47

Merged
merged 1 commit into from
Jan 3, 2023
Merged

Conversation

agerasev
Copy link
Contributor

Disable unstable feature allocator_api if crate feature allocator is disabled. This allows to use this crate with stable Rust.

@schteve
Copy link
Collaborator

schteve commented Jan 3, 2023

This sounds like a great idea! I might be missing something because when I test it I can't get it to build with stable (1.66.0). I get the same error I would expect if I was trying to use a feature gate. Is this perhaps something I'm doing wrong?

> cargo +stable build --no-default-features
...
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> freertos-rust\src/lib.rs:1:44
  |
1 | #![cfg_attr(feature = "allocator", feature(allocator_api))]
  |                                            ^^^^^^^^^^^^^

@agerasev
Copy link
Contributor Author

agerasev commented Jan 3, 2023

I think I got it. You are probably running this command in the repository root, in which case cargo builds all workspace members including freertos-rust-examples which enables all freertos-rust default features even with --no-default-features.
To build only freertos-rust crate you need to go to its own directory and then run cargo:

cd freertos-rust
cargo +stable build --no-default-features --features=sync,time,hooks,interrupt

@schteve
Copy link
Collaborator

schteve commented Jan 3, 2023

Ah, right! Forgot about the workspace. Thanks. All works as expected for me now so I'll go ahead and merge.

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

2 participants