-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Set cargo's output directory to <repo root>/target/
#7625
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon. Please see the contribution instructions for more information. |
target/
<repo root>/target/
Thanks for the PR @kneasle. Can you provide more detail as to what problem this solves? |
The commit message had some more info - when building Clippy, the UI tests runner expects the binary to be in a hard-coded location in the So this PR overrides Cargo's output directory option in Clippy's own |
I wonder if we could actually fix the problem at the source by making the tests work with a different target. But if not, I guess this is fine. We should just make sure it doesn't break the rust repo tests/CI. |
If this comment is anything to go by, it seems you're not the first to think this (and if git blame is anything to go by, that person was @tesuji). But it seems like this requires way more knowledge of compiler internals than I have 😅. I figured this PR would at least get things working for new contributors out of the box (getting everything working was otherwise a very smooth experience). |
I'll have to test if this breaks something in the Rust repo. But since the sync situation between those two repos is currently difficult this will take me about a week. |
That's fine, no stress 😃. |
☔ The latest upstream changes (presumably #7631) made this pull request unmergeable. Please resolve the merge conflicts. |
The UI tests only look in `target/` for the built binaries. However, Cargo allows users to override the target directory - usually to make a single unified target directory. In this case, the unit tests would fail unless the target directory was manually overridden (as is done in this commit).
You should be able to use a custom target directory with #7646. |
Oh excellent, indeed it does - cheers! |
Actually I just found out that I had to add in the cargo config like you have here. But it should be safe to override it. |
Same here, so I've re-opened this PR. For #7640, I had to set it locally and avoid checking the change into git. |
I mean, the change in this PR is also needed in #7646, so it's already included there. |
Oh I seeeeee! Too many similar PR numbers 😅. |
Target directory cleanup changelog: none * .cargo/config now has `target-dir` specified so that it is inherited by child projects. The target directory needs to be shared with clippy_dev, but not necessarily at the project root. (cc #7625) * Uses `std::env::current_exe` (and its parent directories) whenever possible * `CLIPPY_DRIVER_PATH` and `TARGET_LIBS` are no longer required from rustc bootstrap (but `HOST_LIBS` still is). These can be removed from the rustc side after merging. * `CLIPPY_DOGFOOD` and the separate target directory are removed. This was originally added to mitigate #7343. r? `@flip1995`
Makes the tests pass immediately for people (like me) who use a unified
target/
directory by default.