Skip to content

Commit

Permalink
Auto merge of #8321 - hbina:issue_7596, r=alexcrichton
Browse files Browse the repository at this point in the history
Better error message when passing in relative path to Workspace::new

Fixes #7596
  • Loading branch information
bors committed Jun 5, 2020
2 parents e9d7af4 + 84f1dc1 commit de31a34
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,16 @@ impl<'cfg> Workspace<'cfg> {
pub fn new(manifest_path: &Path, config: &'cfg Config) -> CargoResult<Workspace<'cfg>> {
let mut ws = Workspace::new_default(manifest_path.to_path_buf(), config);
ws.target_dir = config.target_dir()?;
ws.root_manifest = ws.find_root(manifest_path)?;

if manifest_path.is_relative() {
anyhow::bail!(
"manifest_path:{:?} is not an absolute path. Please provide an absolute path.",
manifest_path
)
} else {
ws.root_manifest = ws.find_root(manifest_path)?;
}

ws.find_members()?;
ws.resolve_behavior = match ws.root_maybe() {
MaybePackage::Package(p) => p.manifest().resolve_behavior(),
Expand Down

0 comments on commit de31a34

Please sign in to comment.