trybuild icon indicating copy to clipboard operation
trybuild copied to clipboard

Consider how to replace CARGO_MANIFEST_DIR without trailing slash

Open dtolnay opened this issue 2 years ago • 1 comments

https://github.com/dtolnay/trybuild/issues/202#issuecomment-1284634512

My macro outputs "Help: Searching in directory $CARGO_MANIFEST_DIR" when the file it was looking for doesn't exist, which by its nature, will not always be the same path. However, trybuild for some reason doesn't replace that directory with $DIR but leaves the path untouched.

dtolnay avatar Oct 26 '22 17:10 dtolnay

Your solution in issue #202 with CARGO_MANIFEST_OVERRIDE works well for me. One thing that is unfortunate though is that when writing tests, the rust analyzer does not detect this, so i think when it runs my macro it is not finding the file correctly, so my macro doesn't expand.

However, when i run my tests, my tests will pass. As a work around what i am doing is putting in the absolute path into my macro during development. and then after testing looks good i insert the relative path. This works ok. but do you have any other ideas for getting rust analyzer to pick up the override?

Thanks!

(Also since #202 is locked i wrote the comment here, hope thats ok)

TomzBench avatar Sep 14 '23 21:09 TomzBench