Skip to content

do not merge - wip #3966

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

iamjpotts
Copy link
Contributor

@iamjpotts iamjpotts commented Aug 8, 2025

Explores introducing an IntoEncode trait with two methods - one which returns an Encode with the same lifetime, and another which returns an Encode with a 'static lifetime, for future use with named parameter support.

Relevant commit is the last one with commit message wip - IntoEncode

All other commits are a part of open and draft prs preceding this one.

Has unresolved compile errors related to borrowing/lifetime problems for some query bind parameters.

The error which shows up with Option usage (here with Some borrow of string):

error[E0597]: `string` does not live long enough
   --> tests/sqlite/macros.rs:189:14
    |
182 |       let string = "Hello, world!".to_string();
    |           ------ binding `string` declared here
...
185 |       let result = sqlx::query!(
    |  __________________-
186 | |         "SELECT 'Hello, world!' as string where 'Hello, world!' in (?, ?, ?, ?, ?, ?, ?)",
187 | |         string, // make sure we don't actually take ownership here
188 | |         &string[..],
189 | |         Some(&string),
    | |              ^^^^^^^ borrowed value does not live long enough
...   |
193 | |         tuple.0 // make sure we're not trying to move out of a field expression
194 | |     )
    | |_____- argument requires that `string` is borrowed for `'static`
...
201 |   }
    |   - `string` dropped here while still borrowed

For more information about this error, try `rustc --explain E0597`.

@iamjpotts iamjpotts force-pushed the jp/placeholders-into-encode branch from 41aa37f to f59425c Compare August 8, 2025 22:14
@iamjpotts iamjpotts force-pushed the jp/placeholders-into-encode branch from f59425c to 736e5a5 Compare August 10, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant