dtolnay / dtolnay/trybuild

Can't access resources outside of the target folder

Open
#296 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
998
Forks
84
PR merge metrics
No merged PRs in 30d

Description

I have a proc-macro, which loads a file from a given location to generate code.
I call it this way:
```
#[generate_api("tests/good_source_file/mod.rs")]
impl Lifecycle for LifecycleImpl {
```

Using try build the given file can't be found, because "cwd" and "CARGO_TARGET_DIR" are redirected to `$DIR/target/tests/trybuild`.

Is there anyway I can change that?
I don't want to hardcode a full path - the macro assumes the file's location is relative to the project's root directory.

Needless to say, outside of `trybuild::TestCases::new().pass("tests/ui_tests.rs");` the file loading works.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.