Using include-first in workspace members

Open Beginner friendly
#1 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
build-system

Research direction

Start in src/lib.rs at line 50 and reproduce the path resolution while building a workspace member crate. Check the behavior of CARGO_MANIFEST_DIR for the current package, then verify that src/{...} resolves within the member directory rather than the workspace root.

Written by the indexing model from the issue text.

Description

When building a workspace, the working directory during build will be root directory. When building member crates src/{} will point to root/src/{} instead of root/member/src/{} here.

I suggest changing this line to something like this:

let filename = Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("src").join(filename.trim_matches('"'));

CARGO_MANIFEST_DIR always points to the directory of the package currently being built.

Dominant language
Rust
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.