renovatebot/renovate

Invalid version constraints for Cargo when using `rangeStrategy: widen`

Open

#20342 opened on Feb 11, 2023

View on GitHub
 (4 comments) (1 reaction) (0 assignees)TypeScript (14,066 stars) (1,916 forks)batch import
help wantedpriority-4-lowversioning:cargo

Description

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: https://github.com/wetheredge/renovate-bug/pull/1

Relevant debug 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

Contributor guide