mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 21:11:44 +00:00
Auto merge of #8321 - hbina:issue_7596, r=alexcrichton
Better error message when passing in relative path to Workspace::new Fixes #7596
This commit is contained in:
commit
de31a3498d
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue