Pass path or filename of built artifact to tests
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Describe the problem you are trying to solve
I want to run compile test for procedural macros, but the test does not know how to look for the procedural library it should be testing.
Procedural macros are built to libmy_macro-xxxxxx.so in <target-dir>/<build-type>/deps. While it's possible to direct rustc to look at deps directory, there can be multiple instances of the library in the directory, making rustc unable to decide which one should be picked.
When cargo invokes rustc, however, it passes --extern my_macro=... to pick specific file for it, but tests have no way to get such information, mostly because it doesn't know the hash.
Describe the solution you'd like
It would be great if Cargo can pass the path or at least the file name of the built artifact to test via some new environment variable, for example CARGO_LIB_<name> or something like that, similar to the existing CARGO_BIN_EXE_<name>.
Notes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Cargo's existing CARGO_BIN_EXE_ handling and how test invocations receive build-artifact information. Determine where the procedural macro artifact path or filename can be exposed, then verify that a test can select the exact built library rather than an ambiguous file in target//deps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100