Skip to content

Commit b7fe6be

Browse files
committed
Update to newest nightly
1 parent 2cc5bbf commit b7fe6be

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

tokio-postgres/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ where
168168
T: MakeTlsConnect<Socket>,
169169
{
170170
let config = config.parse::<Config>()?;
171-
config.connect(tls).await
171+
// FIXME https://github.com/rust-lang/rust/issues/64391
172+
async move {
173+
config.connect(tls).await
174+
}.await
172175
}
173176

174177
/// An asynchronous notification.

tokio-postgres/src/prepare.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ pub fn prepare(
106106
}
107107
}
108108

109+
fn prepare_rec(client: Arc<InnerClient>, query: &str, types: &[Type]) -> Pin<Box<dyn Future<Output = Result<Statement, Error>> + 'static + Send>> {
110+
Box::pin(prepare(client, query, types))
111+
}
112+
109113
fn encode(name: &str, query: &str, types: &[Type]) -> Result<Vec<u8>, Error> {
110114
let mut buf = vec![];
111115
frontend::parse(name, query, types.iter().map(Type::oid), &mut buf).map_err(Error::encode)?;
@@ -182,10 +186,10 @@ async fn typeinfo_statement(client: &Arc<InnerClient>) -> Result<Statement, Erro
182186
return Ok(stmt);
183187
}
184188

185-
let stmt = match Box::pin(prepare(client.clone(), TYPEINFO_QUERY, &[])).await {
189+
let stmt = match prepare_rec(client.clone(), TYPEINFO_QUERY, &[]).await {
186190
Ok(stmt) => stmt,
187191
Err(ref e) if e.code() == Some(&SqlState::UNDEFINED_TABLE) => {
188-
Box::pin(prepare(client.clone(), TYPEINFO_FALLBACK_QUERY, &[])).await?
192+
prepare_rec(client.clone(), TYPEINFO_FALLBACK_QUERY, &[]).await?
189193
}
190194
Err(e) => return Err(e),
191195
};
@@ -209,10 +213,10 @@ async fn typeinfo_enum_statement(client: &Arc<InnerClient>) -> Result<Statement,
209213
return Ok(stmt);
210214
}
211215

212-
let stmt = match Box::pin(prepare(client.clone(), TYPEINFO_ENUM_QUERY, &[])).await {
216+
let stmt = match prepare_rec(client.clone(), TYPEINFO_ENUM_QUERY, &[]).await {
213217
Ok(stmt) => stmt,
214218
Err(ref e) if e.code() == Some(&SqlState::UNDEFINED_COLUMN) => {
215-
Box::pin(prepare(client.clone(), TYPEINFO_ENUM_FALLBACK_QUERY, &[])).await?
219+
prepare_rec(client.clone(), TYPEINFO_ENUM_FALLBACK_QUERY, &[]).await?
216220
}
217221
Err(e) => return Err(e),
218222
};
@@ -233,7 +237,7 @@ async fn get_composite_fields(client: &Arc<InnerClient>, oid: Oid) -> Result<Vec
233237
for row in rows {
234238
let name = row.try_get(0)?;
235239
let oid = row.try_get(1)?;
236-
let type_ = Box::pin(get_type(client, oid)).await?;
240+
let type_ = get_type_rec(client, oid).await?;
237241
fields.push(Field::new(name, type_));
238242
}
239243

@@ -245,7 +249,7 @@ async fn typeinfo_composite_statement(client: &Arc<InnerClient>) -> Result<State
245249
return Ok(stmt);
246250
}
247251

248-
let stmt = Box::pin(prepare(client.clone(), TYPEINFO_COMPOSITE_QUERY, &[])).await?;
252+
let stmt = prepare_rec(client.clone(), TYPEINFO_COMPOSITE_QUERY, &[]).await?;
249253

250254
client.set_typeinfo_composite(&stmt);
251255
Ok(stmt)

tokio-postgres/tests/test/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ mod types;
2020
async fn connect_raw(s: &str) -> Result<(Client, Connection<TcpStream, NoTlsStream>), Error> {
2121
let socket = TcpStream::connect("127.0.0.1:5433").await.unwrap();
2222
let config = s.parse::<Config>().unwrap();
23-
config.connect_raw(socket, NoTls).await
23+
// FIXME https://github.com/rust-lang/rust/issues/64391
24+
async move { config.connect_raw(socket, NoTls).await }.await
2425
}
2526

2627
async fn connect(s: &str) -> Client {

0 commit comments

Comments
 (0)