Skip to content

Cargo dependency cannot recognize ~ as home path in dependency's path field #14882

Open
@eval-exec

Description

@eval-exec

Problem

I have a dependency on my local file system:

❯ cat Cargo.toml
[package]
name = "cargo-path-bug"
version = "0.1.0"
edition = "2021"

[dependencies]
cargo-path-bug-lib = { path = "~/Temp/cargo-path-bug-lib/", package = "cargo-path-bug-lib"}

But when I run cargo run, it recognize ~ as a dir, not my home path.

❯ cargo run
error: failed to get `cargo-path-bug-lib` as a dependency of package `cargo-path-bug v0.1.0 (/home/exec/Temp/cargo-path-bug)`

Caused by:
  failed to load source for dependency `cargo-path-bug-lib`

Caused by:
  Unable to update /home/exec/Temp/cargo-path-bug/~/Temp/cargo-path-bug-lib

Caused by:
  failed to read `/home/exec/Temp/cargo-path-bug/~/Temp/cargo-path-bug-lib/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

Steps

No response

Possible Solution(s)

request to recognize ~ as home path.

Notes

No response

Version


Metadata

Metadata

Assignees

No one assigned

    Labels

    A-manifestArea: Cargo.toml issuesC-enhancementCategory: enhancementS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions