From 2ef94664508d969eeff15b4534f2fa5a9ccfca69 Mon Sep 17 00:00:00 2001
From: Ed Page <eopage@gmail.com>
Date: Thu, 15 Jun 2023 16:28:54 -0500
Subject: [PATCH] fix(cli): Make 'cargo foo.rs' behave like --manifest-path

This mirrors the logic `ArgMatchesExt::root_manifest`
---
 src/bin/cargo/commands/run.rs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/bin/cargo/commands/run.rs b/src/bin/cargo/commands/run.rs
index 45521b5f05f6..d46ad56c9615 100644
--- a/src/bin/cargo/commands/run.rs
+++ b/src/bin/cargo/commands/run.rs
@@ -96,12 +96,15 @@ pub fn exec_manifest_command(config: &Config, cmd: &str, args: &[OsString]) -> C
     }
 
     let manifest_path = Path::new(cmd);
+    let manifest_path = crate::util::try_canonicalize(manifest_path)?;
+    let manifest_path = cargo_util::paths::normalize_path(&manifest_path);
     if !manifest_path.exists() {
-        return Err(
-            anyhow::anyhow!("manifest `{}` does not exist", manifest_path.display()).into(),
-        );
+        return Err(anyhow::format_err!(
+            "manifest path `{}` does not exist",
+            manifest_path.display()
+        )
+        .into());
     }
-    let manifest_path = crate::util::try_canonicalize(manifest_path)?;
     let mut ws = Workspace::new(&manifest_path, config)?;
     if config.cli_unstable().avoid_dev_deps {
         ws.set_require_optional_deps(false);