Skip to content

Invalid version constraints for Cargo when using rangeStrategy: widen #20342

Description

@wetheredge

How are you running Renovate?

Mend Renovate hosted app on github.com

If you're self-hosting Renovate, tell us what version of Renovate you run.

No response

If you're self-hosting Renovate, select which platform you are using.

None

If you're self-hosting Renovate, tell us what version of the platform you run.

No response

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

Renovate tries to use 1.0.0, ||, 2.0.0 which is invalid. This causes the lockfile update to fail along with my repo's CI. The correct syntax is >=1.0.0, <3.0.0.

Cargo docs: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#multiple-requirements
Example: wetheredge/renovate-bug-20342#1

Relevant debug logs

Logs
DEBUG: Repository config
{
  "fileName": "renovate.json",
  "config": {
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "packageRules": [
      {
        "matchFiles": [
          "Cargo.toml"
        ],
        "matchDepTypes": [
          "dependencies"
        ],
        "rangeStrategy": "widen"
      }
    ]
  }
}
INFO: Dependency extraction complete
{
  "baseBranch": "main",
  "stats": {
    "managers": {
      "cargo": {
        "fileCount": 1,
        "depCount": 1
      }
    },
    "total": {
      "fileCount": 1,
      "depCount": 1
    }
  }
}
DEBUG: 1 flattened updates found: uom
DEBUG: packageFiles with updates
{
  "baseBranch": "main",
  "config": {
    "cargo": [
      {
        "deps": [
          {
            "currentValue": "^0.33.0",
            "currentVersion": "0.33.0",
            "datasource": "crate",
            "depIndex": 0,
            "depName": "uom",
            "depType": "dependencies",
            "dependencyUrl": "https://crates.io/crates/uom",
            "isSingleVersion": false,
            "managerData": {
              "nestedVersion": false
            },
            "registryUrl": "https://crates.io",
            "sourceUrl": "https://github.com/iliekturtles/uom",
            "versioning": "cargo",
            "warnings": [],
            "updates": [
              {
                "bucket": "non-major",
                "newVersion": "0.34.0",
                "newValue": "^0.33.0, ||, ^0.34.0",
                "newMajor": 0,
                "newMinor": 34,
                "updateType": "minor",
                "isRange": true,
                "branchName": "renovate/uom-0.x"
              }
            ]
          }
        ],
        "lockFiles": [
          "Cargo.lock"
        ],
        "packageFile": "Cargo.toml"
      }
    ]
  }
}

Have you created a minimal reproduction repository?

I have linked to a minimal reproduction repository in the bug description

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedHelp is needed or welcomed on this issuepriority-4-lowLow priority, unlikely to be done unless it becomes important to more peopleversioning:cargoCargo versioning

    Type

    Fields

    Priority

    None yet

    Regression introduced in

    None yet

    Datasource

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions