Skip to content

Conversation

@victorchukwuemeka
Copy link

Summary

Adds the missing bpf-entrypoint feature to the SDK's Cargo.toml.

Problem

The documentation examples in src/entrypoint/mod.rs and src/entrypoint/lazy.rs reference a bpf-entrypoint feature that didn't exist in Cargo.toml, causing doctest warnings:

warning: unexpected `cfg` condition value: `bpf-entrypoint`
  --> sdk/src/entrypoint/mod.rs:80:7

Solution

Added bpf-entrypoint = [] to the [features] section in sdk/Cargo.toml.

Testing

  • cargo test --workspace passes without warnings
  • ✅ Doctests now compile successfully

@sonicfromnewyoke
Copy link
Contributor

@victorchukwuemeka alternatively you can add the next rules to the workspace

[workspace.lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
    'cfg(target_os, values("solana"))',
    'cfg(feature, values("no-entrypoint"))',
]

@febo
Copy link
Collaborator

febo commented Dec 4, 2025

The documentation examples in src/entrypoint/mod.rs and src/entrypoint/lazy.rs reference a bpf-entrypoint feature that didn't exist in Cargo.toml, causing doctest warnings:

The warnings that I see are these:
image

These are expected since those tests are meant to be ignored. Do you see a different output?

copy = ["solana-account-view/copy", "solana-address/copy"]
cpi = ["dep:solana-instruction-view"]
default = ["alloc"]
bpf-entrypoint = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not add the feature to the crate since it is not used here. It will be misleading to have it.

Copy link
Author

Choose a reason for hiding this comment

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

The warning was thier when I ran the test, after i added the feature, everything was resolved . Currently, if I run the test from my end, there is no warning message

Copy link
Author

Choose a reason for hiding this comment

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

This was the warning IMG-20251204-WA0000.jpg

Copy link
Author

Choose a reason for hiding this comment

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

After adding the feature
IMG-20251204-WA0002.jpg

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright, I think I found the source of it. There are two doctests that are "tagged" with no_run: here and here.

The best way to prevent the warning this is to add:

//! # #![allow(unexpected_cfgs)]

just before the line:

//! #[cfg(feature = "bpf-entrypoint")]

Copy link
Author

Choose a reason for hiding this comment

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

Okay, let me add it now

Copy link
Author

Choose a reason for hiding this comment

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

Tried it, and the warning came back again

Copy link
Collaborator

Choose a reason for hiding this comment

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

Which rust version are you using?

Copy link
Author

Choose a reason for hiding this comment

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

this is my version
rustc 1.84.1 (e71f9a9a9 2025-01-27)

Copy link
Author

Choose a reason for hiding this comment

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

@febo good day i will love the pr to be reviewed and i also want to contribute in any task that you can ask of

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.

3 participants