diff --git a/src/cargo/util/toml_mut/dependency.rs b/src/cargo/util/toml_mut/dependency.rs index 836fb738363..78cc58a29b7 100644 --- a/src/cargo/util/toml_mut/dependency.rs +++ b/src/cargo/util/toml_mut/dependency.rs @@ -748,7 +748,8 @@ fn path_field<'a>( } else { Cow::Borrowed(crate_root) }; - let relpath = pathdiff::diff_paths(&source.path, relative_to).expect("both paths are absolute"); + let relpath = pathdiff::diff_paths(&source.path, relative_to) + .expect("PathSource::path and workspace path must be absolute"); let relpath = relpath.to_str().unwrap().replace('\\', "/"); Ok(relpath) }