fix: use real cfg gates instead of faking target_os="solana"#100
Merged
fix: use real cfg gates instead of faking target_os="solana"#100
Conversation
The scaffold template injected `--cfg target_os="solana"` into rustflags for the `bpfel-unknown-none` target, lying about the actual target OS. Newer nightly rustc rejects this with `explicit_builtin_cfgs_in_flags`. Instead, gate on `target_arch = "bpf"` (the real cfg for bpfel-unknown-none) alongside the existing `target_os = "solana"` (real for sbf-solana-solana). This matches the pattern already used in ~30 other cfg sites across the codebase — the entrypoint, sysvar macro, and string accessors were the only stragglers. Closes #95 Closes #96
⚡ CU Benchmark (Vault)
Binary size: 6,888 bytes (0 ⚪ bytes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
any(target_os = "solana", target_arch = "bpf")instead of justtarget_os = "solana"--cfg target_os="solana"from the scaffold template — no longer needed sincetarget_arch = "bpf"is the real cfg forbpfel-unknown-noneThis covers both build paths using real cfg values:
cargo build-sbf(sbf-solana-solana)target_os = "solana"cargo build-bpf(bpfel-unknown-none)target_arch = "bpf"Closes #95
Closes #96