Skip to content

Can't access resources outside of the target folder #296

@patmuk

Description

@patmuk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions