fix: resolve path
ownership problems when using sqlx_macros_unstable
#3236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using
--cfg=sqlx_macros_unstable
the codepath taken uses thepath
variable which was taken earlier byresolve_blocking
; this is solved by havingresolve_blocking
take a reference, as it is more convenient than cloning.Does your PR solve an issue?
Yes (however I did not create an issue here).
I was trying to get the effect of triggering recompilation on migration changes by setting the nightly flag as described here: https://docs.rs/sqlx/latest/sqlx/macro.migrate.html#nightly-rust-cfg-flag
But when adding to
.cargo/config.toml
:and having the
sqlx::migrate!
macro in the code, the following error appears while compilingsqlx-macros-core
:Alternatively I could simply clone the
path
variable (as suggested by the compiler), however it seems likeresolve_blocking
does not really need to take ownership of thepath
variable.I'm not too sure how this could be tested. Please let me know if the "tests/x.py" script is a good place to setup a test for this.