Skip to content

Fix sqlx macro expansion: set working directory for proc macro expander process #8271

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

Merged
merged 2 commits into from
Dec 13, 2021

Conversation

vlad20012
Copy link
Member

Fixes #8238

sqlx macros write files to target/sqlx directory by a relative path. It expects that PWD is set to the directory with target (and Cargo.toml) file. In this PR I hotfixed it by setting CARGO_TARGET_DIR env var. I also set PWD to a temporary directory (it's not currently possible to set PWD to different directories for different proc macros, this required changes in rust-analyzer).

changelog: Fix expansion of sqlx procedural macros with offline feature

@vlad20012 vlad20012 added the fix Pull requests that fix some bug(s) label Dec 13, 2021
@vlad20012 vlad20012 self-assigned this Dec 13, 2021
@vlad20012
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 13, 2021

Build succeeded:

@bors bors bot merged commit 79829b7 into master Dec 13, 2021
@bors bors bot deleted the macro-target-dir branch December 13, 2021 22:38
@github-actions github-actions bot added this to the v162 milestone Dec 13, 2021
@mili-l mili-l self-assigned this Dec 14, 2021
bors bot added a commit that referenced this pull request Jan 31, 2022
8489: Update `ra_ap_proc_macro_srv` to `0.0.94`, fix disk usage, fix pwd r=vlad20012 a=vlad20012

This update consists of rust-lang/rust-analyzer#11365, rust-lang/rust-analyzer#11353 and rust-lang/rust-analyzer#11356 PRs

Fixes #7709
Fixes #8238 in a proper way (#8271 was a hacky hotfix)

changelog: Don't fill up disk space by proc macro DLLs on Windows

Co-authored-by: vlad20012 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Pull requests that fix some bug(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proc macro not expanding correctly, Access is denied. (os error 5)
2 participants