Skip to content

Tidy default allocator features #132

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

febo
Copy link
Collaborator

@febo febo commented Apr 15, 2025

Problem

The default_allocator! macro can be used in different contexts, e.g., when running cargo build-sbf, cargo test-sbf or cargo clippy. Currently it is gated by #[cfg(target_os = "solana")], which works fine for cargo build-sbf and cargo test-sbf but it is not present for cargo clippy. This creates a compilation error when the program crate is no_std.

PR #125 solved the issue for clippy, but it is currently generating a warning since there is a misplaced feature = "std" test.

Solution

Use #[cfg(not(any(target_os = "solana", test)))] to gate the placeholder default allocator instead of using feature = "std" test.

This is an alternative solution to PR #128.

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.

1 participant