Skip to content

Commit 224d2e6

Browse files
committed
fix(cli): Make 'cargo foo.rs' behave like --manifest-path
This mirrors the logic `ArgMatchesExt::root_manifest`
1 parent 5ed0792 commit 224d2e6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/bin/cargo/commands/run.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,15 @@ pub fn exec_manifest_command(config: &Config, cmd: &str, args: &[OsString]) -> C
9696
}
9797

9898
let manifest_path = Path::new(cmd);
99+
let manifest_path = config.cwd().join(manifest_path);
100+
let manifest_path = cargo_util::paths::normalize_path(&manifest_path);
99101
if !manifest_path.exists() {
100-
return Err(
101-
anyhow::anyhow!("manifest `{}` does not exist", manifest_path.display()).into(),
102-
);
102+
return Err(anyhow::format_err!(
103+
"manifest path `{}` does not exist",
104+
manifest_path.display()
105+
)
106+
.into());
103107
}
104-
let manifest_path = crate::util::try_canonicalize(manifest_path)?;
105108
let mut ws = Workspace::new(&manifest_path, config)?;
106109
if config.cli_unstable().avoid_dev_deps {
107110
ws.set_require_optional_deps(false);

0 commit comments

Comments
 (0)