From 52870c587c279effc64f6840455a54381c10b3aa Mon Sep 17 00:00:00 2001 From: micolous Date: Wed, 29 Jan 2025 00:25:33 +1000 Subject: [PATCH] Fix incorrect error message when specifying `tool.uv.sources.(package).workspace` with other options (#11013) ## Summary When a `pyproject.toml` `[tool.uv.sources.(package)]` section specifies `workspace` and one or more of (`index`, `git`, `url`, `path`, `rev`, `tag`, `branch`, `editable`), running `uv` to build or sync the package gives the error: ``` cannot specify both `index` and `(parameter name)` ``` The error should actually say: ``` cannot specify both `workspace` and `(parameter name)` ``` ## Test Plan I ran `cargo test`, and all tests still passed. --- crates/uv-workspace/src/pyproject.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/uv-workspace/src/pyproject.rs b/crates/uv-workspace/src/pyproject.rs index 77b60f6a4..b5599d752 100644 --- a/crates/uv-workspace/src/pyproject.rs +++ b/crates/uv-workspace/src/pyproject.rs @@ -1242,42 +1242,42 @@ impl<'de> Deserialize<'de> for Source { if let Some(workspace) = workspace { if index.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `index`", + "cannot specify both `workspace` and `index`", )); } if git.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `git`", + "cannot specify both `workspace` and `git`", )); } if url.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `url`", + "cannot specify both `workspace` and `url`", )); } if path.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `path`", + "cannot specify both `workspace` and `path`", )); } if rev.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `rev`", + "cannot specify both `workspace` and `rev`", )); } if tag.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `tag`", + "cannot specify both `workspace` and `tag`", )); } if branch.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `branch`", + "cannot specify both `workspace` and `branch`", )); } if editable.is_some() { return Err(serde::de::Error::custom( - "cannot specify both `index` and `editable`", + "cannot specify both `workspace` and `editable`", )); }