Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export environment OUT_DIR to proc-macro. #14035

Open
Neutron3529 opened this issue Jun 9, 2024 · 1 comment
Open

Export environment OUT_DIR to proc-macro. #14035

Neutron3529 opened this issue Jun 9, 2024 · 1 comment
Labels
A-proc-macro Area: compiling proc-macros C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@Neutron3529
Copy link

Problem

Currently, crates-io will yield such error:

error: failed to verify package tarball

Caused by:
  Source directory was modified by build.rs during cargo publish. Build scripts should not modify anything outside of OUT_DIR.
  Added: /me/rmin/target/package/rmin-examples-0.0.1/aaa.rmin.Rust.Functions.R

But since I only have a proc-macro and no build.rs, the OUT_DIR is not set. And since I need some of their output (generating R wrappers for further roxygen2 doc generation and further package loading), the output is necessary.

Is there some configuration that could make a OUT_DIR visible for proc-macros?

Proposed Solution

Currently, for build.rs, it could write output to OUT_DIR, but for proc-macro-only crate, such option does not exists.

Another solution is that adding a [cache] section in Cargo.toml, tell Cargo what file could be written. With this configure, we may have the ability to debug proc-macros by tell them writting down all the code they generates.

Notes

No response

@Neutron3529 Neutron3529 added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Jun 9, 2024
@epage epage added the A-proc-macro Area: compiling proc-macros label Jun 10, 2024
@epage
Copy link
Contributor

epage commented Jun 10, 2024

See also Internals discussion

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macro Area: compiling proc-macros C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants