diff --git a/crates/uv-resolver/src/pubgrub/package.rs b/crates/uv-resolver/src/pubgrub/package.rs index 5502948c264f..c631d4403727 100644 --- a/crates/uv-resolver/src/pubgrub/package.rs +++ b/crates/uv-resolver/src/pubgrub/package.rs @@ -196,13 +196,13 @@ impl std::fmt::Display for PubGrubPackageInner { name, extra: None, marker: None, - .. + dev: None, } => write!(f, "{name}"), Self::Package { name, extra: Some(extra), marker: None, - .. + dev: None, } => { write!(f, "{name}[{extra}]") } @@ -210,19 +210,40 @@ impl std::fmt::Display for PubGrubPackageInner { name, extra: None, marker: Some(marker), - .. + dev: None, } => write!(f, "{name}{{{marker}}}"), Self::Package { name, extra: Some(extra), marker: Some(marker), - .. + dev: None, } => { write!(f, "{name}[{extra}]{{{marker}}}") } + Self::Package { + name, + extra: None, + marker: None, + dev: Some(dev), + } => write!(f, "{name}:{dev}"), + Self::Package { + name, + extra: None, + marker: Some(marker), + dev: Some(dev), + } => { + write!(f, "{name}[{dev}]{{{marker}}}") + } Self::Marker { name, marker, .. } => write!(f, "{name}{{{marker}}}"), Self::Extra { name, extra, .. } => write!(f, "{name}[{extra}]"), Self::Dev { name, dev, .. } => write!(f, "{name}:{dev}"), + // It is guaranteed that `extra` and `dev` are never set at the same time. + Self::Package { + name: _, + extra: Some(_), + marker: _, + dev: Some(_), + } => unreachable!(), } } } diff --git a/crates/uv/tests/workspace.rs b/crates/uv/tests/workspace.rs index d5f4a45e22ad..76acda86cf95 100644 --- a/crates/uv/tests/workspace.rs +++ b/crates/uv/tests/workspace.rs @@ -1439,7 +1439,7 @@ fn workspace_unsatisfiable_member_dependencies_conflicting_dev() -> Result<()> { ----- stderr ----- Using Python 3.12.[X] interpreter at: [PYTHON-3.12] × No solution found when resolving dependencies: - ╰─▶ Because bar depends on bar:dev and bar depends on anyio==4.2.0, we can conclude that bar depends on anyio==4.2.0. + ╰─▶ Because bar depends on bar:dev and bar:dev depends on anyio==4.2.0, we can conclude that bar depends on anyio==4.2.0. And because foo depends on anyio==4.1.0, we can conclude that bar and foo are incompatible. And because your workspace requires bar and foo, we can conclude that your workspace's requirements are unsatisfiable. "###