@@ -77,7 +77,6 @@ use crate::sources::CRATES_IO_REGISTRY;
77
77
use crate :: util:: errors:: CargoResult ;
78
78
use crate :: util:: network:: http:: configure_http_handle;
79
79
use crate :: util:: network:: http:: http_handle;
80
- use crate :: util:: try_canonicalize;
81
80
use crate :: util:: { internal, CanonicalUrl } ;
82
81
use crate :: util:: { Filesystem , IntoUrl , IntoUrlWithBase , Rustc } ;
83
82
use anyhow:: { anyhow, bail, format_err, Context as _} ;
@@ -457,11 +456,10 @@ impl GlobalContext {
457
456
// commands that use Cargo as a library to inherit (via `cargo <subcommand>`)
458
457
// or set (by setting `$CARGO`) a correct path to `cargo` when the current exe
459
458
// is not actually cargo (e.g., `cargo-*` binaries, Valgrind, `ld.so`, etc.).
460
- let exe = try_canonicalize (
461
- self . get_env_os ( crate :: CARGO_ENV )
462
- . map ( PathBuf :: from)
463
- . ok_or_else ( || anyhow ! ( "$CARGO not set" ) ) ?,
464
- ) ?;
459
+ let exe = self
460
+ . get_env_os ( crate :: CARGO_ENV )
461
+ . map ( PathBuf :: from)
462
+ . ok_or_else ( || anyhow ! ( "$CARGO not set" ) ) ?;
465
463
Ok ( exe)
466
464
} ;
467
465
@@ -470,7 +468,7 @@ impl GlobalContext {
470
468
// The method varies per operating system and might fail; in particular,
471
469
// it depends on `/proc` being mounted on Linux, and some environments
472
470
// (like containers or chroots) may not have that available.
473
- let exe = try_canonicalize ( env:: current_exe ( ) ? ) ?;
471
+ let exe = env:: current_exe ( ) ?;
474
472
Ok ( exe)
475
473
}
476
474
@@ -481,8 +479,6 @@ impl GlobalContext {
481
479
// Otherwise, it has multiple components and is either:
482
480
// - a relative path (e.g., `./cargo`, `target/debug/cargo`), or
483
481
// - an absolute path (e.g., `/usr/local/bin/cargo`).
484
- // In either case, `Path::canonicalize` will return the full absolute path
485
- // to the target if it exists.
486
482
let argv0 = env:: args_os ( )
487
483
. map ( PathBuf :: from)
488
484
. next ( )
0 commit comments