Skip to content

publishing a crate that depends on itself as a dev dependency #15151

Open
@mockersf

Description

Problem

It used to be possible to publish a crate that depends upon itself as a dev dependency:

[package]
name = "my_crate"
version = "0.1.1"
edition = "2021"

[dependencies]

[dev-dependencies]
my_crate = { path = ".", version = "0.1.1", features = ["feature-for-test"] }

[features]
default = []
feature-for-test = []

This pattern is useful when you have a feature that you want to enable for tests

This worked on January 3rd, see the dev dependencies of https://crates.io/crates/bevy_math/0.15.1/dependencies published with cargo 1.83

This failed today with cargo 1.84.1

    Updating crates.io index
   Packaging bevy_math v0.15.2 (crates/bevy_math)
    Updating crates.io index
error: failed to prepare local package for uploading

Caused by:
  failed to select a version for the requirement `bevy_math = "^0.15.2"`
  candidate versions found which didn't match: 0.15.1, 0.15.0, 0.15.0-rc.3, ...
  location searched: crates.io index
  required by package `bevy_math v0.15.2 (crates/bevy_math)`

Steps

  1. have a crate that depends on itself as a dev dependency
  2. publish it

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.84.1 (66221abde 2024-11-19)
release: 1.84.1
commit-hash: 66221abdeca2002d318fde6efff516aab091df0e
commit-date: 2024-11-19
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 15.1.0 [64-bit]

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