Skip to content

Commit 6893425

Browse files
cursoragentlovasoa
andcommitted
Fix: Add missing lifetime bounds to Executor trait
Co-authored-by: contact <[email protected]>
1 parent 17c8274 commit 6893425

File tree

6 files changed

+31
-29
lines changed

6 files changed

+31
-29
lines changed

sqlx-core/src/executor.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub trait Executor<'c>: Send + Debug + Sized {
3333
where
3434
'c: 'e,
3535
'q: 'e,
36-
E: Execute<'q, Self::Database>,
36+
E: Execute<'q, Self::Database> + 'e,
3737
{
3838
self.execute_many(query).try_collect().boxed()
3939
}
@@ -46,7 +46,7 @@ pub trait Executor<'c>: Send + Debug + Sized {
4646
where
4747
'c: 'e,
4848
'q: 'e,
49-
E: Execute<'q, Self::Database>,
49+
E: Execute<'q, Self::Database> + 'e,
5050
{
5151
self.fetch_many(query)
5252
.try_filter_map(|step| async move {
@@ -66,7 +66,7 @@ pub trait Executor<'c>: Send + Debug + Sized {
6666
where
6767
'c: 'e,
6868
'q: 'e,
69-
E: Execute<'q, Self::Database>,
69+
E: Execute<'q, Self::Database> + 'e,
7070
{
7171
self.fetch_many(query)
7272
.try_filter_map(|step| async move {
@@ -93,7 +93,7 @@ pub trait Executor<'c>: Send + Debug + Sized {
9393
where
9494
'c: 'e,
9595
'q: 'e,
96-
E: Execute<'q, Self::Database>;
96+
E: Execute<'q, Self::Database> + 'e;
9797

9898
/// Execute the query and return all the generated results, collected into a [`Vec`].
9999
fn fetch_all<'e, 'q, E>(
@@ -103,7 +103,7 @@ pub trait Executor<'c>: Send + Debug + Sized {
103103
where
104104
'c: 'e,
105105
'q: 'e,
106-
E: Execute<'q, Self::Database>,
106+
E: Execute<'q, Self::Database> + 'e,
107107
{
108108
self.fetch(query).try_collect().boxed()
109109
}
@@ -116,7 +116,7 @@ pub trait Executor<'c>: Send + Debug + Sized {
116116
where
117117
'c: 'e,
118118
'q: 'e,
119-
E: Execute<'q, Self::Database>,
119+
E: Execute<'q, Self::Database> + 'e,
120120
{
121121
self.fetch_optional(query)
122122
.and_then(|row| match row {
@@ -134,7 +134,7 @@ pub trait Executor<'c>: Send + Debug + Sized {
134134
where
135135
'c: 'e,
136136
'q: 'e,
137-
E: Execute<'q, Self::Database>;
137+
E: Execute<'q, Self::Database> + 'e;
138138

139139
/// Prepare the SQL query to inspect the type information of its parameters
140140
/// and results.

sqlx-core/src/mssql/connection/executor.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ impl MssqlConnection {
7171
impl<'c> Executor<'c> for &'c mut MssqlConnection {
7272
type Database = Mssql;
7373

74-
fn fetch_many<'e, 'q: 'e, E: 'q>(
74+
fn fetch_many<'e, 'q, E>(
7575
self,
7676
mut query: E,
7777
) -> BoxStream<'e, Result<Either<MssqlQueryResult, MssqlRow>, Error>>
7878
where
7979
'c: 'e,
80+
'q: 'e,
8081
E: Execute<'q, Self::Database>,
8182
{
8283
let sql = query.sql();
@@ -135,12 +136,10 @@ impl<'c> Executor<'c> for &'c mut MssqlConnection {
135136
})
136137
}
137138

138-
fn fetch_optional<'e, 'q: 'e, E: 'q>(
139-
self,
140-
query: E,
141-
) -> BoxFuture<'e, Result<Option<MssqlRow>, Error>>
139+
fn fetch_optional<'e, 'q, E>(self, query: E) -> BoxFuture<'e, Result<Option<MssqlRow>, Error>>
142140
where
143141
'c: 'e,
142+
'q: 'e,
144143
E: Execute<'q, Self::Database>,
145144
{
146145
let mut s = self.fetch_many(query);
@@ -156,13 +155,14 @@ impl<'c> Executor<'c> for &'c mut MssqlConnection {
156155
})
157156
}
158157

159-
fn prepare_with<'e, 'q: 'e>(
158+
fn prepare_with<'e, 'q>(
160159
self,
161160
sql: &'q str,
162161
_parameters: &[MssqlTypeInfo],
163162
) -> BoxFuture<'e, Result<MssqlStatement<'q>, Error>>
164163
where
165164
'c: 'e,
165+
'q: 'e,
166166
{
167167
Box::pin(async move {
168168
let metadata = prepare(self, sql).await?;
@@ -174,12 +174,13 @@ impl<'c> Executor<'c> for &'c mut MssqlConnection {
174174
})
175175
}
176176

177-
fn describe<'e, 'q: 'e>(
177+
fn describe<'e, 'q>(
178178
self,
179179
sql: &'q str,
180180
) -> BoxFuture<'e, Result<Describe<Self::Database>, Error>>
181181
where
182182
'c: 'e,
183+
'q: 'e,
183184
{
184185
Box::pin(async move {
185186
let metadata = prepare(self, sql).await?;

sqlx-core/src/pool/executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ where
2121
) -> BoxStream<'e, Result<Either<DB::QueryResult, DB::Row>, Error>>
2222
where
2323
'q: 'e,
24-
E: Execute<'q, Self::Database>,
24+
E: Execute<'q, Self::Database> + 'e,
2525
{
2626
let pool = self.clone();
2727

@@ -40,7 +40,7 @@ where
4040
fn fetch_optional<'e, 'q, E>(self, query: E) -> BoxFuture<'e, Result<Option<DB::Row>, Error>>
4141
where
4242
'q: 'e,
43-
E: Execute<'q, Self::Database>,
43+
E: Execute<'q, Self::Database> + 'e,
4444
{
4545
let pool = self.clone();
4646

sqlx-core/src/postgres/connection/executor.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,13 @@ impl PgConnection {
360360
impl<'c> Executor<'c> for &'c mut PgConnection {
361361
type Database = Postgres;
362362

363-
fn fetch_many<'e, 'q: 'e, E: 'q>(
363+
fn fetch_many<'e, 'q, E>(
364364
self,
365365
mut query: E,
366366
) -> BoxStream<'e, Result<Either<PgQueryResult, PgRow>, Error>>
367367
where
368368
'c: 'e,
369+
'q: 'e,
369370
E: Execute<'q, Self::Database>,
370371
{
371372
let sql = query.sql();
@@ -385,12 +386,10 @@ impl<'c> Executor<'c> for &'c mut PgConnection {
385386
})
386387
}
387388

388-
fn fetch_optional<'e, 'q: 'e, E: 'q>(
389-
self,
390-
mut query: E,
391-
) -> BoxFuture<'e, Result<Option<PgRow>, Error>>
389+
fn fetch_optional<'e, 'q, E>(self, mut query: E) -> BoxFuture<'e, Result<Option<PgRow>, Error>>
392390
where
393391
'c: 'e,
392+
'q: 'e,
394393
E: Execute<'q, Self::Database>,
395394
{
396395
let sql = query.sql();
@@ -412,13 +411,14 @@ impl<'c> Executor<'c> for &'c mut PgConnection {
412411
})
413412
}
414413

415-
fn prepare_with<'e, 'q: 'e>(
414+
fn prepare_with<'e, 'q>(
416415
self,
417416
sql: &'q str,
418417
parameters: &'e [PgTypeInfo],
419418
) -> BoxFuture<'e, Result<PgStatement<'q>, Error>>
420419
where
421420
'c: 'e,
421+
'q: 'e,
422422
{
423423
Box::pin(async move {
424424
self.wait_until_ready().await?;
@@ -432,12 +432,13 @@ impl<'c> Executor<'c> for &'c mut PgConnection {
432432
})
433433
}
434434

435-
fn describe<'e, 'q: 'e>(
435+
fn describe<'e, 'q>(
436436
self,
437437
sql: &'q str,
438438
) -> BoxFuture<'e, Result<Describe<Self::Database>, Error>>
439439
where
440440
'c: 'e,
441+
'q: 'e,
441442
{
442443
Box::pin(async move {
443444
self.wait_until_ready().await?;

sqlx-core/src/postgres/listener.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl<'c> Executor<'c> for &'c mut PgListener {
343343
where
344344
'c: 'e,
345345
'q: 'e,
346-
E: Execute<'q, Self::Database>,
346+
E: Execute<'q, Self::Database> + 'e,
347347
{
348348
futures_util::stream::once(async move {
349349
// need some basic type annotation to help the compiler a bit
@@ -358,7 +358,7 @@ impl<'c> Executor<'c> for &'c mut PgListener {
358358
where
359359
'c: 'e,
360360
'q: 'e,
361-
E: Execute<'q, Self::Database>,
361+
E: Execute<'q, Self::Database> + 'e,
362362
{
363363
async move { self.connection().await?.fetch_optional(query).await }.boxed()
364364
}

sqlx-core/src/postgres/options/parse.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ impl FromStr for PgConnectOptions {
5454
}
5555

5656
"sslrootcert" | "ssl-root-cert" | "ssl-ca" => {
57-
options = options.ssl_root_cert(&value);
57+
options = options.ssl_root_cert(&*value);
5858
}
5959

60-
"sslcert" | "ssl-cert" => options = options.ssl_client_cert(&value),
60+
"sslcert" | "ssl-cert" => options = options.ssl_client_cert(&*value),
6161

62-
"sslkey" | "ssl-key" => options = options.ssl_client_key(&value),
62+
"sslkey" | "ssl-key" => options = options.ssl_client_key(&*value),
6363

6464
"statement-cache-capacity" => {
6565
options =
@@ -68,7 +68,7 @@ impl FromStr for PgConnectOptions {
6868

6969
"host" => {
7070
if value.starts_with("/") {
71-
options = options.socket(&value);
71+
options = options.socket(&*value);
7272
} else {
7373
options = options.host(&value);
7474
}

0 commit comments

Comments
 (0)