Fix CI after Rust 1.80, remove dead feature references (#3381)

* fix(ci): update workflows/examples.yml

* Removed archived `actions-rs` actions
* Upgraded `Swatinem/rust-cache`, `actions/checkout`, `actions/download-artifact`, `actions/upload-artifact`

* chore: deprecate `AnyKind`

* fix: remove dead references to DB features in `sqlx-core`

This reactivates a couple of tests that had stopped working.

* chore(ci): move sqlx-cli checks to their own workflow

* fix(ci): remove remaining `uses: actions-rs/cargo`

* fix warnings

* chore: add titles to sqlx-cli jobs

* fix warnings (2)

* fix error in pool example

* fix warnings (3)

* fix query_builder test

* fix: don't run CLI tests on Windows

* chore: upgrade `rust-toolchain` to 1.80

* fix(postgres): fix missing Tokio specialization in `PgCopyIn`

Caught by the new `unexpected_cfgs` lint.

* fix new warnings
This commit is contained in:
Austin Bonander
2024-07-26 23:15:32 -07:00
committed by GitHub
parent 1e526a2bbf
commit 6651d2df72
22 changed files with 334 additions and 352 deletions

View File

@@ -1,14 +1,15 @@
use futures_core::future::BoxFuture;
use std::borrow::Cow;
use std::ops::{Deref, DerefMut};
use futures_core::future::BoxFuture;
use futures_core::stream::BoxStream;
use sqlx_core::bytes::{BufMut, Bytes};
use crate::connection::PgConnection;
use crate::error::{Error, Result};
use crate::ext::async_stream::TryAsyncStream;
use crate::io::{AsyncRead, AsyncReadExt};
use crate::io::AsyncRead;
use crate::message::{
CommandComplete, CopyData, CopyDone, CopyFail, CopyResponse, MessageFormat, Query,
};
@@ -45,7 +46,7 @@ impl PgConnection {
///
/// 1. by closing the connection, or:
/// 2. by using another connection to kill the server process that is sending the data as shown
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
///
/// If you don't read the stream to completion, the next time the connection is used it will
/// need to read and discard all the remaining queued data, which could take some time.
@@ -98,7 +99,7 @@ pub trait PgPoolCopyExt {
///
/// 1. by closing the connection, or:
/// 2. by using another connection to kill the server process that is sending the data as shown
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
/// [in this StackOverflow answer](https://stackoverflow.com/a/35319598).
///
/// If you don't read the stream to completion, the next time the connection is used it will
/// need to read and discard all the remaining queued data, which could take some time.
@@ -220,20 +221,12 @@ impl<C: DerefMut<Target = PgConnection>> PgCopyIn<C> {
// we get canceled or read 0 bytes, but that should be fine.
buf.put_slice(b"d\0\0\0\x04");
let read = match () {
// Tokio lets us read into the buffer without zeroing first
#[cfg(feature = "_rt-tokio")]
_ => source.read_buf(buf.buf_mut()).await?,
#[cfg(not(feature = "_rt-tokio"))]
_ => source.read(buf.init_remaining_mut()).await?,
};
let read = buf.read_from(&mut source).await?;
if read == 0 {
break;
}
buf.advance(read);
// Write the length
let read32 = u32::try_from(read)
.map_err(|_| err_protocol!("number of bytes read exceeds 2^32: {}", read))?;

View File

@@ -1,5 +1,3 @@
use std::i16;
use crate::io::PgBufMutExt;
use crate::io::{BufMutExt, Encode};
use crate::types::Oid;