Skip to content

Point out which crates have a wildcard version that isn't allowed #6827

Closed
@carols10cents

Description

@carols10cents

Current Behavior

A user tried to publish a crate with this Cargo.toml:

`Cargo.toml` content
[package]
name = "arbitrary"
version = "0.4.9"
description = "arbitrary"
edition = "2021"
license = "MIT"
readme = "README.md"

[lib]
crate-type = ["cdylib", "lib"]
name = "amm"

[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
staging = []
test-bpf = []
test-bpf-snapshot = []

[profile.release]
overflow-checks = true

[dependencies]
anchor-lang = "0.26.0"
anchor-spl = "0.26.0"
mercurial-vault = { version = "0.4.7", features = ["cpi"] }
spl-token-swap = { version = "3.0.0", features = ["no-entrypoint"] }
meteora-stable-swap-math = "1.8.1"
meteora-stable-swap-client = "1.8.1"
meteora-marinade-sdk = { version = "0.1.0", features = ["cpi"] }
spl-stake-pool = { ver="0.6.4", features = ["no-entrypoint"] }
anyhow = "1.0.71"

[dev-dependencies]
solana-program-test = "~1.14.17"
solana-sdk = "~1.14.17"
solana-account-decoder = "~1.14.17"
solana-client = "~1.14.17"
spl-associated-token-account = { version = "1.1.2", features = ["no-entrypoint"] }
serde_json = "1.0.95"
serde = "1.0.159"
bincode = "1.3.3"

and got this error:

Caused by:
  the remote server responded with an error: wildcard (`*`) dependency constraints are not allowed 
on crates.io. See 
https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies 
for more information

Can you spot the problem? How long did it take you?

Answer

The problem was this line:

spl-stake-pool = { ver="0.6.4", features = ["no-entrypoint"] }

that had ver instead of version, which is interpreted as "no version" or "wildcard" by crates.io.

Expected Behavior

If crates.io instead returned an error like this, pointing out which crate or crates in the list of dependencies was causing the problem:

Caused by:
  the remote server responded with an error: wildcard (`*`) dependency constraints are not allowed 
on crates.io. Dependencies with this problem: crate-x[, crate-y, crate-z, ...]. See 
https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies for more information

it would be a lot easier to figure out what the problem was.

Steps To Reproduce

  1. Attempt to publish a crate with a bunch of dependencies, some of which have a wildcard version constraint or no version constraint.
  2. Get error message.

Environment

  • Browser: all
  • OS: all

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions