Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

[change request] Change ::solana_program to solana_program in macros #24303

Closed
paul-schaaf opened this issue Apr 12, 2022 · 1 comment
Closed
Labels
stale [bot only] Added to stale content; results in auto-close after a week.

Comments

@paul-schaaf
Copy link
Contributor

Problem

Some macros like pubkey! use ::solana_program (https://docs.rs/solana-sdk-macro/1.10.8/src/solana_sdk_macro/lib.rs.html#117) instead of solana_program.

This means that when users use pubkey! in a framework like anchor, they have to specify solana-program as a dependency instead of being able to use the re-exported anchor_lang::solana_program.

Proposed Solution

I might be wrong but if my understanding of ::<x> is correct (and it requires solana_program to be a seperate dependency), it would be great if the :: could be removed so users of anchor no longer have to do that and can just use the re-exported anchor_lang::solana_program.

@jstarry
Copy link
Contributor

jstarry commented Apr 17, 2022

I'm not sure that dropping the :: makes this any better. The error becomes:

error[E0433]: failed to resolve: use of undeclared crate or module `solana_program`
 --> src/lib.rs:4:13
  |
4 |     let u = pubkey!("Et2tm6NsfBZJbEYXtWTv9k51V4tWtQvufexSgXoDRGVA");
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `solana_program::pubkey`

I think it's reasonable to ask end-users to add solana-program = "*" to their Cargo.toml and allow cargo to take care of resolving the same solana-program version that is bundled in anchor.

@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Apr 18, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale [bot only] Added to stale content; results in auto-close after a week.
Projects
None yet
Development

No branches or pull requests

2 participants